Host python dist-packages in sys.path of snapcraft's python

Bug #1767434 reported by Adam Collard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Sergio Schvezov

Bug Description

$ /snap/snapcraft/current/usr/bin/python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/snap/snapcraft/current/usr/lib/python35.zip', '/snap/snapcraft/current/usr/lib/python3.5', '/snap/snapcraft/current/usr/lib/python3.5/plat-x86_64-linux-gnu', '/snap/snapcraft/current/usr/lib/python3.5/lib-dynload', '/home/acollard/.local/lib/python3.5/site-packages', '/home/acollard/.local/lib/python3.5/site-packages/GitPython-2.1.3-py3.5.egg', '/home/acollard/.local/lib/python3.5/site-packages/gitdb2-2.0.0-py3.5.egg', '/home/acollard/.local/lib/python3.5/site-packages/smmap2-2.0.1-py3.5.egg', '/usr/lib/python3/dist-packages', '/snap/snapcraft/current/usr/lib/python3/dist-packages']
>>> import snapcraft.storeapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'snapcraft'
>>> import snapcraft.storeapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'snapcraft'
>>> import pymacaroons
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/pymacaroons/__init__.py", line 2, in <module>
    from .macaroon import Macaroon
  File "/usr/lib/python3/dist-packages/pymacaroons/macaroon.py", line 13, in <module>
    from pymacaroons.caveat_delegates import (
  File "/usr/lib/python3/dist-packages/pymacaroons/caveat_delegates/__init__.py", line 4, in <module>
    from .encrypted_first_party import (
  File "/usr/lib/python3/dist-packages/pymacaroons/caveat_delegates/encrypted_first_party.py", line 5, in <module>
    from pymacaroons.field_encryptors import SecretBoxEncryptor
  File "/usr/lib/python3/dist-packages/pymacaroons/field_encryptors/__init__.py", line 2, in <module>
    from .secret_box_encryptor import SecretBoxEncryptor
  File "/usr/lib/python3/dist-packages/pymacaroons/field_encryptors/secret_box_encryptor.py", line 3, in <module>
    from nacl.secret import SecretBox
  File "/usr/lib/python3/dist-packages/nacl/secret.py", line 17, in <module>
    import nacl.bindings
  File "/usr/lib/python3/dist-packages/nacl/bindings/__init__.py", line 17, in <module>
    from nacl.bindings.crypto_box import (
  File "/usr/lib/python3/dist-packages/nacl/bindings/crypto_box.py", line 18, in <module>
    from nacl._sodium import ffi, lib
ImportError: No module named 'nacl._sodium'
>>> import site
>>> site.PREFIXES
['/snap/snapcraft/current/usr', '/snap/snapcraft/current/usr']
>>> site.USER_BASE
'/home/acollard/.local'
>>> site.USER_SITE
'/home/acollard/.local/lib/python3.5/site-packages'
>>> sys.path_hooks
[<class 'zipimport.zipimporter'>, <function FileFinder.path_hook.<locals>.path_hook_for_FileFinder at 0x7f3a531c6950>]
>>> sys.prefix
'/snap/snapcraft/current/usr'
>>> sys.platform
'linux'

Changed in snapcraft:
assignee: nobody → Sergio Schvezov (sergiusens)
status: New → Triaged
milestone: none → 2.43
Revision history for this message
Sergio Schvezov (sergiusens) wrote : Re: [Bug 1767434] [NEW] Host python dist-packages in sys.path of snapcraft's python

According to https://www.python.org/dev/peps/pep-0370/ I need to edit
site.py for our deployment. In the end this is application specific as
such is the case of an application like fades which would want these to
be loaded.

This should be fixed shortly

Changed in snapcraft:
importance: Undecided → High
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
status: Triaged → In Progress
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
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.