← Back to issue list

fix: fix Python venv in core24 classic snaps

View original Github issue

Metadata

Project
snapcraft
Number
#4946
Type
pull request
State
merged
Author
tigarmo
Labels
—
Created
Updated
Closed

Current evaluation

PR #4946 squash-merged as 952a8e04d, fixing the Python plugin in core24 classic snaps by rewriting pyvenv.cfg's "home" key to /snap/<name>/current. Closes bug #4942.

Resolution: closed resolved

Reason: Approved and squash-merged (commit 952a8e04d); the new post_prime() step in snapcraft/parts/plugins/python_common.py skips core22 and rewrites the build-system "home" path in prime_dir/pyvenv.cfg to the snap's runtime path. Reviewer mr-cal confirmed remaining spread failures were unrelated and merged to 8.3.0.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Changes to virtual environment handling made our default approach - creating a venv in the build system and then just moving it into the snap - not work for Python 3.12. My understanding of the issue is that the "home" key in the "pyvenv.cfg" file points to a path in the build system, which obviously does not exist at snap-run-time. This apparently works fine *somehow* in core22 - likely there's some fallback logic that makes the interpreter correctly find the bundled Python libraries, but not in core24. So to address this we update this "home" key to point to its final destination in the snap. Fixes #4942 - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `tox run -m lint`? - [ ] Have you successfully run `tox run -e test-py310`? (supported versions: `py39`, `py310`, `py311`, `py312`) -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved PR #4946 squash-merged as 952a8e04d, fixing the Python plugin in core24 classic snaps by rewriting pyvenv.cfg's "home" key to /snap/<name>/current. Closes bug #4942.
stealth/space-bunny-alpha — closed resolved Fixed Python venv handling for core24 classic snaps by setting pyvenv.cfg's home to its final snap path. PR #4946 was squash-merged as 952a8e04d.
qwen/qwen3.6-35b-a3b — — 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.
qwen3.6-35b-a3b-mtp-q6 — — Squash-merged to fix Python venv handling in core24 classic snaps. The change updates the pyvenv.cfg home key to point to the snap runtime path instead of the build system, resolving Python 3.12 compatibility issues and closing #4942.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#4942 (confidence 98%)

    The bug report this PR explicitly fixes ("Fixes #4942"); issue was closed by this merge.

Related issues

Issue Project State Summary Similarity
#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.
84%