System Python modules not found when running snap C application

I’m trying to create a snap for one of my C applications. Said application spawns a Python process, but the snap version complains that some modules are missing but they are indeed installed on my system.

Here is my snapcraft.yaml configuration

name: austin # you probably want to 'snapcraft register <name>'
version: '0.6.1-beta' # just for humans, typically '1.2+git' or '1.3.2'
summary: A Python frame stack sampler for CPython # 79 char long summary
description: |
  Austin is a Python frame stack sampler for CPython written in pure C. It
  samples the stack traces of a Python application so that they can be
  visualised and analysed. As such, it serves the basis for building powerful
  profilers for Python.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

    plugin: autotools
    source: git://
    source-depth: 1

    command: bin/austin

Is there a setting that could fix this? It looks like the Python that is being invoked comes from /snap/core/current/usr/bin/python3. I would like to use whatever is available from the system instead.


Well looks like a solution could be

confinement: classic

However I would like to hear if this is the clean solution to the problem. I would have expected the devmode to be less restrictive than strict. In my case, it looks like I won’t be able to use devmode while developing.

classic is almost never a “solution”, it is an interim hack until a proper interface exists for your app to access the bits of the host it needs access to … classic drops all confinement and is as insecure as untarring a pre-compiled binary tarball somewhere on your system … as such, classic snaps need to go through a very detailed review before even being allowed into the store.

if you are missing python modules, you should just make sure to properly ship them inside your snap, classic is not the solution for this.

Are you shipping python in your snap, or are you using the python from core?

@chipaca I have no need to ship Python. Austin works with Python but is Python version-agnostic. Nor I can expect that a random Python application will use the Python from the Snap environment. My application is a C tool that either launches or attaches to a running Python application, so in general it needs the system Python installation.

@ogra Even if I included Python as a dependency, I cannot possibly list all the possible Python modules that a Python application might require. If the classic confinement is a hack then I won’t be able to distribute my application via the Snap Store. In fact, the standard installation is either compilation from sources or the untarring of a binary from a release.

I have created another post where I have requested a classic confinement review.