charmcraft `3.1.1` "successfully" packs charm, but python packages are missing in the venv
Metadata
Current evaluation
Strict-dependency packing now runs pip check and rejects inconsistent venvs; fixed in PR #1784 (fd21df24) and backported to 3.1 via PR #1794 (1ac1aa59).
Resolution: closed resolved
Reason: PR #1784, commit fd21df24, added pip check validation so inconsistent virtual environments fail instead of producing incomplete charms. PR #1794, commit 1ac1aa59, cherry-picked the fix to the 3.1 hotfix branch.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
Packing the grafana-agent charm in charmcraft 3.1.1 appears to complete successfully, but results in a charm that has packages missing in the charm's venv. Packing works fine in charmcraft 2.7.x
### To Reproduce
```
# Download a "control" charm
juju download grafana-agent --channel latest/edge
# Pack something new to compare
git clone git@github.com:canonical/grafana-agent-operator.git
charmcraft pack
# inspect the .charm file's venv. The newly packed charm will have a much emptier venv
```
### Environment
ubuntu 24.04
### charmcraft.yaml
[charmcraft.yaml](https://github.com/canonical/grafana-agent-operator/blob/main/charmcraft.yaml)
### Relevant log output
[pastebin](https://pastebin.ubuntu.com/p/wztzCvywwf/)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Strict-dependency packing now runs pip check and rejects inconsistent venvs; fixed in PR #1784 (fd21df24) and backported to 3.1 via PR #1794 (1ac1aa59). | |
| stealth/space-bunny-alpha | — | closed resolved | Strict-deps accepted inconsistent venvs; PR #1784 (fd21df24) added pip check validation, and PR #1794 (1ac1aa59) backported it to the 3.1 hotfix branch. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #1784 (fd21df24), cherry-picked to the 3.1 hotfix in PR #1794 (1ac1aa59); strict-dependency packing now fails when the venv has missing dependencies. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Missing Python packages in charmcraft 3.1.1 venvs resulted from a strict dependencies bug. The developer identified the missing pip check step, implemented a fix, and closed the report after updating validation logic. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed after a developer identified a strict dependencies bug causing missing Python packages. Resolution adds a pip check validation step to verify the virtual environment contains all required dependencies before packing. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Developer acknowledged the regression and committed a fix to add a missing pip check, ensuring the strict dependencies implementation validates the virtual environment. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by adding pip check validation to strict dependencies. Charmcraft 3.1.1 skipped dependency verification, causing missing packages in packed charms. The fix ensures the venv contains all required dependencies. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#1784
(confidence 100%)
Merged fix adding pip check validation for strict-dependencies environments.
-
Likely Fixed By:
canonical/charmcraft#1794
(confidence 100%)
Backported the validation fix to the 3.1 hotfix branch.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1077 Charms can import packages not installed in `venv` | charmcraft | closed | Charm-plugin behavior remains unchanged; Python and Poetry plugins add venv isolation, available in Charmcraft 3.3 via #1899 (8b748f3e). | |
| #1456 Strict dependencies prevents charm from building | charmcraft | closed | Fixed in PR #1716 (commit def89c50): Charmcraft raised its minimum pip version so strict-dependency builds upgrade old virtual environments first. | |
| #551 [charmcraft 1.3]: Cannot pack a charm with Jinja2 as dependency | charmcraft | closed | Jinja2 pack failure in charmcraft 1.3 was traced to old setuptools in the build venv. Resolved by merged PR #553 (ccec8b7e, commit 4b2d291b) adding a charm-python-packages charm plugin property, letting charms preinstall setuptools. |