charmcraft `3.1.1` "successfully" packs charm, but python packages are missing in the venv
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved and closed. Developer added pip check to strict dependencies validation to catch missing packages during packaging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1077 Charms can import packages not installed in `venv` | charmcraft | closed | Closed without fixing in the charm plugin. The behavior remains unchanged, but new python and poetry plugins in charmcraft 3.3 include venv isolation protections. Migration to these plugins is recommended. | |
| #551 [charmcraft 1.3]: Cannot pack a charm with Jinja2 as dependency | charmcraft | closed | Charmcraft 1.3 failed to pack charms with Jinja2 due to dependency issues. Closed with a setuptools workaround. Resolved via PR #553, which adds a charm-python-packages property to pre-install dependencies before requirements. | |
| #758 charmcraft installation via PIP started failing recently | charmcraft | closed | A newer craft-parts release broke compatibility with the pinned pydantic version, failing charmcraft pip installs. The issue was fixed by updating dependency constraints and merged in PR #765. | |
| #1664 `charm-python-packages` does not guarantee these packages are installed before packages in `requirements.txt` | charmcraft | closed | Fixed in Charmcraft 3.2. Maintainers confirmed the charm-python-packages installation ordering bug was resolved through related PRs and subsequent releases. The issue is closed. | |
| #1472 charmcraft 2.5.2 on PyPi doesn't install on jammy/py310 (at least) - error "ModuleNotFoundError: No module named 'tools'" | charmcraft | closed | Packaging error in charmcraft 2.5.2 caused install failures due to the missing tools module. The bug was fixed in Charmcraft 3.0. A backport to the 2.x branch was requested but not implemented. | |
| #922 Unable to pack charms on a GCP instance | charmcraft | closed | Closed as not a Charmcraft bug. The error stems from a pip and setuptools version mismatch. Maintainers provided a workaround: adding setuptools to charm-python-packages in charmcraft.yaml to force an update and resolve the build failure. |