Python site-packages are not found in core18 classic snaps

Bug #1815202 reported by Martin Wimpress 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Invalid
Medium
Sergio Schvezov

Bug Description

When creating a classic Python snap using core18 python modules in site-packages are not loadable. This can be worked around by adding the following environment:

    environment:
      PYTHONPATH: $PYTHONPATH:$SNAP/lib/python3.6/site-packages

Changed in snapcraft:
milestone: none → 3.2
assignee: nobody → Sergio Schvezov (sergiusens)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Download full text (4.8 KiB)

I cannot seem to reproduce your issue. Mind adding more information or trying again? Here's what I tried out:

snapcraft-black # cat project/snap/snapcraft.yaml
name: black
base: core18
version: git
summary: boo
description: boo
grade: devel
confinement: classic

apps:
  black:
    command: bin/black

parts:
  black:
    source: .
    plugin: python
snapcraft-black # ls prime/lib/python3.6/site-packages/
Click-7.0.dist-info blackd.py setuptools-40.8.0.dist-info
appdirs-1.4.3.dist-info blib2to3 toml
appdirs.py click toml-0.10.0.dist-info
attr easy_install.py toml.py
attrs-18.2.0.dist-info pip wheel
black-18.9b0-py3.6.egg-info pip-19.0.2.dist-info wheel-0.32.3.dist-info
black-18.9b0.dist-info pkg_resources
black.py setuptools
snapcraft-black # snap try prime --classic
black 0+git.250ba7f mounted from /root/prime
snapcraft-black # black --help
Usage: black [OPTIONS] [SRC]...

  The uncompromising code formatter.

Options:
  -l, --line-length INTEGER How many characters per line to allow.
                                  [default: 88]
  -t, --target-version [pypy35|cpy27|cpy33|cpy34|cpy35|cpy36|cpy37|cpy38]
                                  Python versions that should be supported by
                                  Black's output. [default: per-file auto-
                                  detection]
  --py36 Allow using Python 3.6-only syntax on all
                                  input files. This will put trailing commas
                                  in function signatures and calls also after
                                  *args and **kwargs. [default: per-file
                                  auto-detection]
  --pyi Format all input files like typing stubs
                                  regardless of file extension (useful when
                                  piping source on standard input).
  -S, --skip-string-normalization
                                  Don't normalize string quotes or prefixes.
  --check Don't write the files back, just return the
                                  status. Return code 0 means nothing would
                                  change. Return code 1 means some files
                                  would be reformatted. Return code 123 means
                                  there was an internal error.
  --diff Don't write the files back, just output a
                                  diff for each file on stdout.
  --fast / --safe If --fast given, skip temporary sanity
                                  checks. [default: --safe]
  --include TEXT A regular expression that matches files and
                                  directories that should be included on
                                  recursive searches. An empty value means
                                  all files are included regardless of the
                                  name. Use forward slashes for directories
                                  on all platforms (Windows, too). Exclusions
                         ...

Read more...

Changed in snapcraft:
status: Triaged → Incomplete
Revision history for this message
Martin Wimpress  (flexiondotorg) wrote :

Clone this repo for a real world example:

  * https://github.com/Wimpressive-Snaps/mycli

Changed in snapcraft:
status: Incomplete → New
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Download full text (60.0 KiB)

I have also tried this just now

sergiusens@cuivienen:~/projects/snapcrafters/mycli$ git diff --ws-error-highlight=context
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index d8955b1..266b549 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -7,7 +7,7 @@ description: |
   highlighting.

 grade: stable
-confinement: strict
+confinement: classic

 parts:
   mycli:
@@ -20,4 +20,4 @@ apps:
     environment:
       LC_ALL: C.UTF-8
     plugs:
- - network
\ No newline at end of file
+ - network
sergiusens@cuivienen:~/projects/snapcrafters/mycli$ snapcraft
Launching a VM.
launch failed: qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory

An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
sergiusens@cuivienen:~/projects/snapcrafters/mycli$ snapcraft
Launching a VM.
launch failed: qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory

An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
sergiusens@cuivienen:~/projects/snapcrafters/mycli$ snapcraft
Launching a VM.
launch failed: qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory

An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
sergiusens@cuivienen:~/projects/snapcrafters/mycli$ snapcraft
Launching a VM.
Launched: snapcraft-mycli
2019-02-15T14:01:08Z INFO Waiting for restart...
core 16-2.37.2 from 'canonical' installed
snapcraft 3.1.1 from Canonical✓ installed
core18 18 from Canonical✓ installed
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
38 packages can be upgraded. Run 'apt list --upgradable' to see them.
Installing build dependencies: binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base git less libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libcurl3-gnutls libdpkg-perl liberror-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgomp1 libisl19 libitm1 liblsan0 libmpc3 libmpx2 libpython3-dev libpython3.6 libpython3.6-dev libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev make manpages manpages-dev python-pip-whl python3-crypto python3-dev python3-distutils python3-keyring python3-keyrings.alt python3-lib2to3 python3-pip python3-secretstorage python3-setuptools python3-wheel python3-xdg python3.6-dev ...

Changed in snapcraft:
status: New → Incomplete
Changed in snapcraft:
milestone: 3.2 → none
Changed in snapcraft:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.