The Python plugin can create conflicting interpreters
Metadata
Current evaluation
Python plugin creates conflicting interpreters on core26 when staging Python via stage-packages; shebangs should point to /bin/python3
Suggested action: keep open
Reason: The issue is very fresh (5 days old), has been triaged (Status: Triaged label), and describes a clear bug with reproduction steps and a proposed fix (patching shebangs to /bin/python3). The Starcraft team has agreed on the approach, making it ready for implementation.
Impact:
50
Quick Win:
25.0
Staleness:
0
Complexity:
50
Confidence:
80
Support Request:
0
Issue body
### Check existing issues
- [x] I've verified that this bug isn't described by any existing issues.
### Bug description
When building a snap that stages its own Python interpreter with `stage-packages` (most notably, on core26) and uses the Python plugin to build, you can end up with two options for Python interpreters making it into the final artifact. There's the system Python from `stage-packages`, at `/bin/python3`, and then the venv Python from the plugin at `/usr/bin/python3`.
The venv Python is typically a symlink to the system Python, but the issue arises with things like `PYTHONPATH`. Since these "appear" as different interpreters, they'll search different things for imports, environments, and things such as `pyvenv.cfg`.
Most applications want and expect to be ran with the system Python, but the venv Python appears on the `PATH` first. Some current workarounds are:
- Unstage the venv interpreter on the Python plugin part
- Use layouts to bind `/usr/bin/python3` to `$SNAP/bin/python3`
- Mangle your app's `PATH` to put `/bin` first
The fix that the Starcraft team seems to agree on is to patch all shebangs to point to `/bin/python3` instead of `/usr/bin/env python3`, that way this interpreter "selection" is more consistent.
Relevant forum post: https://forum.snapcraft.io/t/core26-bundled-python-changes/50178/17
### Steps to reproduce
Build a core26 Python project that stages its own Python interpreter and builds with the Python plugin.
### Environment
N/A
### snapcraft.yaml
```yaml
N/A
```
### Log output
```shell
N/A
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b |
Impact:
50
Quick Win:
25.0
Staleness:
0
Complexity:
50
Confidence:
80
Support Request:
0
|
keep open | Python plugin creates conflicting interpreters on core26 when staging Python via stage-packages; shebangs should point to /bin/python3 | |
| qwen/qwen3.6-35b-a3b |
Impact:
50
Quick Win:
25.0
Staleness:
10
Complexity:
50
Confidence:
75
Support Request:
10
|
keep open | Python plugin creates conflicting interpreters on core26 when staging Python via stage-packages; team agreed to patch shebangs to /bin/python3 | |
| qwen/qwen3.6-35b-a3b |
Impact:
70
Quick Win:
28.0
Staleness:
5
Complexity:
60
Confidence:
85
Support Request:
10
|
keep open | Python plugin creates conflicting interpreters on core26 when staging Python, causing PATH/PYTHONPATH issues. Triaged and acknowledged by maintainers. | |
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
75
Quick Win:
33.75
Staleness:
5
Complexity:
55
Confidence:
85
Support Request:
10
|
keep open | Core26 Python plugin creates conflicting interpreters (/bin/python3 vs /usr/bin/python3) causing import issues; suggests patching shebangs to /bin/python3. Issue is triaged and fresh. |
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| updated | |
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3451 python v2 plugin: fix multiple python parts with staged python | snapcraft | merged | Merged fix for Python v2 plugin regression causing file conflicts and broken symlinks with multiple staged Python parts. The update resolves the interpreter before virtual environment creation to prevent unmanaged symlinks. |