Python libraries installed by python path are not found in sys.path
Bug #1876370 reported by
Alberto Donato
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Triaged
|
Low
|
Unassigned |
Bug Description
snapcraft 4.0, on a core20 snap
Python libraries and apps installed by a python part (via pip or setup.pyt dependencies) are installed in $SNAP/lib/
sys.path = [
'/',
'/usr/
'/usr/
'/usr/
'/usr/
]
As such, those modules are not found when running the app.
To post a comment you must log in.
Can you share your yaml?
If using stage-packages, currently core20 will require the user to set PYTHONPATH in the app's environment to inform python where the staged-packages are. E.g.:
https:/ /github. com/snapcore/ snapcraft/ blob/master/ tests/spread/ plugins/ v2/snaps/ python- hello-with- stage-package- dep/snap/ snapcraft. yaml#L15
If using python-packages with the python-plugin, it should handle the case described above, e.g.:
https:/ /github. com/snapcore/ snapcraft/ blob/master/ tests/spread/ plugins/ v2/snaps/ python- hello-with- python- package- dep/snap/ snapcraft. yaml
['', '/usr/lib/ python38. zip', '/usr/lib/ python3. 8', '/usr/lib/ python3. 8/lib-dynload' , '/snap/ python- hello-with- python- package- dep/x2/ lib/python3. 8/site- packages' ]
Can you confirm/deny the following:
(1) `snap run --shell <snap>` then `which python3` yields $SNAP/bin/python3 ?
(2) that your script has a shebang of `#!/usr/bin/env python3` ?
Thanks!