← Back to issue list

Bad sys.path for classic Python2

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1696127
Type
issue
State
closed
Author
~stub
Labels
Created
Updated
Closed

Current evaluation

⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.

Classic Python 2 snaps incorrectly prioritize system and user local paths in sys.path, causing package shadowing. The report was closed without comments or a fix, indicating it was abandoned.

Suggested action:

No scores available.

Issue body

Classic snaps currently need a work around, specifying $PYTHONPATH in the application's environment: PYTHONPATH: $SNAP/lib/python2.7/site-packages:$SNAP/usr/lib/python2.7/dist-packages:$PYTHONPATH However, this is still failing with Python packages in the main filesystem are shadowing versions in the snap. It appears that the snapped Python interpreter is inserting the system path into the start of sys.path. stub@uurp:~/src/mojo/snap$ snap run --shell mojo stub@uurp:~/src/mojo/snap$ echo $PYTHONPATH /snap/mojo/3/lib/python2.7/site-packages:/snap/mojo/3/usr/lib/python2.7/dist-packages: stub@uurp:~/src/mojo/snap$ which python /snap/mojo/3/usr/bin/python stub@uurp:~/src/mojo/snap$ python Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pprint import pprint >>> import sys >>> pprint(sys.path) ['', '/home/stub/.local/lib/python2.7/site-packages/websocket_client-0.39.0-py2.7.egg', '/home/stub/.local/lib/python2.7/site-packages/jujuclient-0.53.3-py2.7.egg', '/home/stub/.local/lib/python2.7/site-packages/juju_deployer-0.2.5-py2.7.egg', '/usr/lib/python2.7/dist-packages', '/home/stub/.local/lib/python2.7/site-packages/codetree-0.1.4-py2.7.egg', '/home/stub/.local/lib/python2.7/site-packages/futures-3.0.5-py2.7.egg', '/home/stub/.local/lib/python2.7/site-packages/mojo-0.3.1-py2.7.egg', '/home/stub/.local/lib/python2.7/site-packages/python_cinderclient-1.9.0-py2.7.egg', '/snap/mojo/3/lib/python2.7/site-packages', '/snap/mojo/3/usr/lib/python2.7/dist-packages', '/home/stub/src/mojo/snap', '/snap/mojo/3/usr/lib/python2.7', '/snap/mojo/3/usr/lib/python2.7/plat-x86_64-linux-gnu', '/snap/mojo/3/usr/lib/python2.7/lib-tk', '/snap/mojo/3/usr/lib/python2.7/lib-old', '/snap/mojo/3/usr/lib/python2.7/lib-dynload', '/home/stub/.local/lib/python2.7/site-packages'] >>> If I explicitly add /usr/lib/python2.7/dist-packages to the end of the PYTHONPATH in snapcraft.yaml, it gets better; the interpreter does not add an entry to the start of the PYTHONPATH. However, I can't stop packages installed into ~/.local via pip from shadowing and breaking the snap. Even if I add $HOME/.local/lib/python2.7/site-packages to the PYTHONPATH in the environment, eggs installed into ~/.local are still inserted first.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Classic Python 2 snaps incorrectly prioritize system and user local paths in sys.path, causing package shadowing. The report was closed without comments or a fix, indicating it was abandoned.
qwen/qwen3.6-35b-a3b Closed without fix. Reported sys.path misordering in classic Python 2 snaps causing local packages to shadow snap dependencies. Issue abandoned due to inactivity and zero comments.
qwen3.6-35b-a3b-mtp-q6 Closed without resolution due to inactivity. Classic Python 2 snaps incorrectly prioritize system and user site-packages in sys.path, causing package shadowing. No fix was implemented.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1880319 Python plugin --classic snap conflicts with system python snapcraft (launchpad) closed Closed without comments or resolution, likely abandoned. The issue reported a Python plugin conflict where classic confinement snaps incorrectly imported host system libraries instead of packaged dependencies.
70%