← 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

Add a Python-plugin guard for classic snaps staged without the python3-minimal symlink; current post_prime only rewrites pyvenv.cfg, leaving the core24 failure mode unresolved.

Suggested action: keep open

Reason: The body provides a concrete condition and failure mode: staging python3.12-minimal without python3-minimal produces home = /usr/bin and an unusable core24 classic snap. Current post_prime only rewrites pyvenv.cfg, and the spread tests still expect an unprovisioned classic snap to fail with "No suitable Python interpreter found," so the defect is not demonstrably resolved.

Evaluated by: mr-cal-bot

Impact: 64 Quick Win: 37 Complexity: 31 Confidence: 90 Actionability: 83

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
stealth/space-bunny-alpha
Impact: 64
Quick Win: 37
Complexity: 31
Confidence: 90
Actionability: 83
keep open Add a Python-plugin guard for classic snaps staged without the python3-minimal symlink; current post_prime only rewrites pyvenv.cfg, leaving the core24 failure mode unresolved.
stealth/space-bunny-alpha
Impact: 38
Quick Win: 21
Complexity: 30
Confidence: 76
Actionability: 78
keep open Maintainer-filed enhancement: add a post_prime check in snapcraft/parts/plugins/python_common.py to error out when a core24 classic Python snap is built with the host system python instead of a staged one, which currently yields a broken pyvenv.cfg.
qwen/qwen3.6-35b-a3b
Impact: 65
Quick Win: 32
Complexity: 35
Confidence: 75
Actionability: 75
keep open Feature request to add validation in python_common.py post_prime to error out when classic snaps use system python instead of staged python, preventing broken pyvenv.cfg.
qwen/qwen3.8-27b
Impact: 55
Quick Win: 30
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.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#5407 (confidence 92%)

    The same core24 classic provisioning problem was closed as a configuration issue after explicitly staging python3.12-minimal and using bin/python; no resolving Snapcraft change was cited.

Related issues

Issue Project State Summary Similarity
#786 Python plugin. Python is broken in core24 classic snaps if snap is used on an older Ubuntu LTS version craft-parts open Core24 classic snaps using the Python plugin fail on older Ubuntu LTS hosts because staged Python cannot find its stdlib; Snapcraft 8.3.2's fix proved incomplete, with follow-up in snapcraft#5144.
76%
#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: staging python3.12-minimal and invoking bin/python made the core24 classic Python snap build work; no fixing PR or commit was cited.
74%
#4942 Python plugin is broken in core24 snapcraft closed Python plugin broke in core24 classic snaps due to Python 3.12 venv changes. Fixed by PR #4946 (squash-merged as 952a8e04d), which rewrites pyvenv.cfg's "home" key to /snap/<name>/current in snapcraft/parts/plugins/python_common.py.
72%
#1880319 Python plugin --classic snap conflicts with system python snapcraft (launchpad) closed Classic Python snap handling was fixed by merged PR #1093 (e7824093f), preventing host-environment leakage and using a classic-compatible interpreter.
71%
#1660 Python plugin fails on core26: base snap does not include Python interpreter craft-parts open core26 lacks a Python runtime, so Python-plugin builds fail unless Python is staged. Documentation covers the workaround, and maintainers are pursuing clearer warning guidance.
70%