← Back to issue list

uv plugin fails on core26: dispatch script uses system Python instead of venv

View original Github issue

Metadata

Project
charmcraft
Number
#2788
Type
issue
State
open
Author
zyga
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

uv plugin breaks core26 charm builds: craft-parts strips venv python symlinks, dispatch falls back to system Python lacking ops. Acknowledged by lengau, ownership moved into Charmcraft (CHARMCRAFT-714).

Suggested action: keep open

Reason: Maintainer lengau explicitly validated ownership — "The Charmcraft uv plugin is different enough (especially when taking into account the dispatch script) that I'm going to move this into Charmcraft directly" — and a JIRA ticket (CHARMCRAFT-714) was auto-created, confirming it is a real triaged bug (Status: Triaged, Type: Bug). The report is high quality: exact repro YAML (`base: ubuntu@26.04`, `plugin: uv`), verbatim build log showing `rm .../venv/bin/python3.14` then `symlink_target=/usr/bin/python3.14`, and the runtime `ModuleNotFoundError: No module named 'ops'`. No resolving commit or PR exists in the evidence I gathered, so it must stay open. Confidence is capped because the repo tools lost their pinned SHA mid-session and I could not verify the current dispatch-script implementation or whether a fix has since landed; the fix location also spans craft-parts' plugin and Charmcraft's dispatch template, which needs a design decision among the four options proposed.

Evaluated by: mr-cal-bot

Impact: 68 Quick Win: 24 Complexity: 55 Confidence: 76 Actionability: 78

Issue body

## Problem The uv plugin fails when building charms on Ubuntu 26.04 (core26) because craft-parts removes python symlinks from `venv/bin/` and the dispatch script's fallback uses the system Python interpreter, which doesn't have venv packages installed. ## Root Cause On core26, the base snap does NOT include Python. The uv plugin flow: 1. Creates a venv with `uv venv --relocatable --python /usr/bin/python3.14` 2. Runs `uv sync` to install dependencies (ops, cosl, etc.) 3. craft-parts removes `python*` symlinks from `venv/bin/` 4. craft-parts tries to find Python in the payload - fails (core26 has no Python) 5. craft-parts falls back to system interpreter path `/usr/bin/python3.14` 6. The dispatch script checks if `venv/bin/python` exists - it doesn't 7. The dispatch script creates `ln -s $(which python3) venv/bin/python` 8. This symlinks to the system Python, which doesn't have `ops` installed Result: `ModuleNotFoundError: No module named 'ops'` at runtime. ## Reproduction ```yaml base: ubuntu@26.04 parts: charm: plugin: uv source: . build-snaps: - astral-uv ``` ## Build Output ``` :: + uv venv --relocatable --allow-existing --python /usr/bin/python3.14 /root/parts/charm/install/venv :: + uv sync --no-dev --no-editable --reinstall --no-install-project :: + rm /root/parts/charm/install/venv/bin/python /root/parts/charm/install/venv/bin/python3 /root/parts/charm/install/venv/bin/python3.14 :: + echo 'Python interpreter not found in payload.' :: Python interpreter not found in payload. :: + symlink_target=/usr/bin/python3.14 ``` The dispatch script then creates `venv/bin/python -> /usr/bin/python3`, which doesn't have venv packages. ## Runtime Error ``` File "/var/lib/juju/agents/unit-image-garden-stream-0/charm/src/charm.py", line 20, in <module> from ops.charm import CharmBase ModuleNotFoundError: No module named 'ops' ``` ## Related - craft-parts canonical/craft-parts#1580 - claims "core26+ and bare are fine" but this shows they are not ## Suggested Fix Options: 1. On core26, automatically include python3 as a dependency in the payload 2. Don't remove python symlinks from venv/bin/ when the interpreter is not in the payload 3. Have craft-parts copy the interpreter to the payload when it's not available 4. Document that core26 requires additional configuration for the uv plugin

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 68
Quick Win: 24
Complexity: 55
Confidence: 76
Actionability: 78
keep open uv plugin breaks core26 charm builds: craft-parts strips venv python symlinks, dispatch falls back to system Python lacking ops. Acknowledged by lengau, ownership moved into Charmcraft (CHARMCRAFT-714).
stealth/space-bunny-alpha
Impact: 65
Quick Win: 21
Complexity: 60
Confidence: 82
Actionability: 82
keep open Bug: uv-plugin charms built on base core26 (Ubuntu 26.04) get a dispatch script that symlinks venv/bin/python to the system interpreter, so charms fail at runtime with ModuleNotFoundError: ops. Triaged, moved to Charmcraft as CHARMCRAFT-714.
stealth/space-bunny-alpha
Impact: 62
Quick Win: 19
Complexity: 64
Confidence: 92
Actionability: 86
keep open Triaged core26 bug: the uv charm dispatch script links venv/bin/python to system Python after payload symlink removal, causing a missing ops error. Maintainer redirected ownership to Charmcraft.
stealth/space-bunny-alpha
Impact: 68
Quick Win: 32
Complexity: 48
Confidence: 93
Actionability: 91
keep open Triaged Charmcraft bug: the uv plugin’s dispatch fallback selects system Python on core26, bypassing the venv and causing a missing ops import at runtime.
qwen3.6-35b-a3b-mtp-q6
Impact: 55
Quick Win: 25
Staleness: 45
Complexity: 55
Confidence: 75
Support Request: 15
keep open uv plugin fails on core26: craft-parts removes python symlinks from venv/bin/, dispatch script falls back to system Python without venv packages. Triaged and moved to Charmcraft by maintainer.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 65
Confidence: 90
Support Request: 5
keep open uv plugin fails on core26 because craft-parts removes venv Python symlinks, causing the dispatch script to fall back to system Python which lacks required packages. Issue is triaged and under investigation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 5
Complexity: 65
Confidence: 90
Support Request: 5
keep open Bug report detailing uv plugin failure on Ubuntu core26 due to dispatch script falling back to system Python instead of using the venv. Acknowledged by maintainer and moved to Charmcraft for tracking.

Update history

No update history recorded yet.

Related work

  • Duplicate Of: canonical/craft-parts#1641 (confidence 92%)

    Identical title ('uv plugin fails on core26: dispatch script uses system Python instead of venv'); still open and untriaged upstream, so the craft-parts entry is the duplicate to close once Charmcraft tracks it.

  • Related To: canonical/craft-parts#1580 (confidence 45%)

    Reporter cites #1580 as claiming 'core26+ and bare are fine', but that issue is actually 'uv plugin documentation is misleading' (closed by merged #1589) — the cross-reference appears to be inaccurate and may confuse triage.

Related issues

Issue Project State Summary Similarity
#1641 uv plugin fails on core26: dispatch script uses system Python instead of venv craft-parts open core26 has no Python in the base snap, so uv-built parts find no interpreter in the payload and fall back to the system python, leaving venv/bin/python pointing at a bare interpreter that lacks ops. Fix options undecided.
87%