← Back to issue list

error out if core24 classic python snap is created with the non-staged python binary

View original Github issue

Metadata

Project
snapcraft
Number
#5144
Type
issue
State
open
Author
dariuszd21
Labels
Created
Updated
Closed

Current evaluation

Feature request to add a post_prime check in the python plugin that errors when a core24 classic snap is built with the host python (/usr/bin/python*) instead of a staged interpreter, which produces a broken pyvenv.cfg (home = /usr/bin). No labels, no comments, no activity for ~2 years.

Suggested action: needs triage

Reason: The issue has zero comments, no labels, and no maintainer interaction in 655 days, so it has never been triaged. The underlying problem is still relevant: python_common.py's get_system_interpreter() returns None for classic confinement, and craft-parts' base.py only errors when no staged interpreter is found at all — it does not detect the case where a partial python (e.g. python3.12-minimal without the python3 symlink) causes the venv to be created with the build host python, leaving pyvenv.cfg with home = /usr/bin. The existing python-symlinks spread tests (classic-not-provisioned) confirm the 'not found' path is covered, but the 'wrong interpreter used' path described here is not, so the request is still valid and needs a maintainer to scope it.

Impact: 55 Quick Win: 30.25 Staleness: 80 Complexity: 45 Confidence: 70 Support Request: 10

Issue body

### What needs to get done Add logic to the `post_prime` of the python plugin to error out if classic snap is created using system python (`/usr/bin/python*`) https://github.com/canonical/snapcraft/blob/main/snapcraft/parts/plugins/python_common.py#L67 ### Why it needs to get done If core24 classic python snap stages `python3.12-minimal`, but no `python3-minimal` (symlink to the python binary), virtualenv is created incorrectly (using build host python) and `pyvenv.cfg` ends up with incorrect entry `home = /usr/bin`. That makes this snap unusable on the host with the different Ubuntu version that the given core It also breaks re-building `core24` classic python snaps

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 55
Quick Win: 30.25
Staleness: 80
Complexity: 45
Confidence: 70
Support Request: 10
needs triage Feature request to add a post_prime check in the python plugin that errors when a core24 classic snap is built with the host python (/usr/bin/python*) instead of a staged interpreter, which produces a broken pyvenv.cfg (home = /usr/bin). No labels, no comments, no activity for ~2 years.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 30
Confidence: 80
Support Request: 10
needs triage Request to add validation in the python plugin's post_prime hook to fail if a core24 classic snap uses the system python binary, preventing broken virtualenvs and cross-version incompatibility. Currently untriaged and inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 20
Confidence: 75
Support Request: 10
needs triage Request to add validation in the python plugin to fail if a core24 classic snap uses the host system python instead of a staged binary, preventing broken virtualenvs. Currently untriaged and inactive for 600 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 88
Complexity: 42
Confidence: 78
Support Request: 10
needs triage Add validation to the python plugin to fail classic snap builds using the system python binary. Prevents broken virtualenvs and incompatible snaps. Currently open, unassigned, and inactive for nearly two years.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#5407 Unable to build Python snaps using classic confinement with core24 using snapcraft 8.8.0 (8.x/stable) snapcraft closed Resolved as a configuration issue. Classic Python snaps on core24 require explicitly adding python3.12-minimal to stage-packages and adjusting the app command. The developer acknowledged documentation gaps and announced upcoming Python plugin improvements.
74%
#786 Python plugin. Python is broken in core24 classic snaps if snap is used on an older Ubuntu LTS version craft-parts open Python plugin bug: core24 classic snaps fail on older Ubuntu LTS (20.04/22.04) with 'No module named encodings'. Original problem fixed in Snapcraft 8.3.2 via PR #4946; residual follow-up tracked in snapcraft#5144. Inactive since Sept 2024.
71%
#4946 fix: fix Python venv in core24 classic snaps snapcraft merged Merged a fix for Python virtual environment handling in core24 classic snaps. Updates the pyvenv.cfg home key to the final snap path, resolving Python 3.12 compatibility issues. Squash-merged on August 1, 2024, following transient CI failure resolution.
71%