Strict dependencies prevents charm from building
Metadata
Current evaluation
Fixed in PR #1716 (commit def89c50): Charmcraft raised its minimum pip version so strict-dependency builds upgrade old virtual environments first.
Resolution: closed resolved
Reason: Merged PR #1716, commit def89c50, raised Charmcraft's minimum pip version to 24.1 and uses the pinned 24.1.1 release when needed. This prevents the legacy pip resolution failure that omitted MarkupSafe.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
`ModuleNotFoundError: No module named 'markupsafe'` when building charm with `charm-strict-dependencies: true`
### To Reproduce
```
git clone https://github.com/canonical/mysql-router-operator
git checkout with-hashes
tox run -e pack-wrapper
mv requirements-last-build.txt requirements.txt
charmcraft pack
```
### Environment
Ubuntu 22.04
### charmcraft.yaml
```shell
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
bases:
# Whenever "bases" is changed:
# - Update tests/integration/conftest.py::pytest_configure()
# - Update .github/workflow/ci.yaml integration-test matrix
- build-on:
- name: "ubuntu"
channel: "20.04"
run-on:
- name: "ubuntu"
channel: "20.04"
- build-on:
- name: "ubuntu"
channel: "22.04"
run-on:
- name: "ubuntu"
channel: "22.04"
parts:
charm:
override-pull: |
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
charm-strict-dependencies: true
charm-entrypoint: src/machine_charm.py
```
### Relevant log output
[charmcraft-20240103-154031.230848.log](https://github.com/canonical/charmcraft/files/13820882/charmcraft-20240103-154031.230848.log)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed in PR #1716 (commit def89c50): Charmcraft raised its minimum pip version so strict-dependency builds upgrade old virtual environments first. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by #1437 (fe263387), raising Charmcraft's build pip minimum to 23; the update was backported to 2.x by #1723 (5e119c36). | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Strict dependencies build failed due to outdated pip. Maintainers identified pip>=23.2.1 as required. The issue was closed without a fix, as the reporter confirmed charmcraft 2.7.1 still lacks the update. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed unfixed. Charmcraft's outdated pip version causes markupsafe failures with strict dependencies. Maintainers identified enforcing pip>=23.2.1 as the solution, but the reporter confirmed the issue persists in charmcraft 2.7.1. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The strict dependencies build failure caused by an outdated pip version was identified as a charmcraft bug, but no fix was implemented. The reporter confirmed the issue persists in charmcraft 2.7.1. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. Maintainers identified an outdated pip version as the cause and suggested a fix, but the reporter confirmed charmcraft 2.7.1 still lacks the update. The issue appears abandoned. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#1716
(confidence 98%)
Merged as def89c50 to upgrade the builder's minimum pip version.
-
Related To:
canonical/charmcraft#1437
(confidence 88%)
Earlier pip 23 bump addressed the same dependency-resolution class but did not fully resolve the reported behavior.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1437 fix(charm_builder): bump minimum pip version to 23 | charmcraft | merged | Merged #1437 in commit fe263387, raising charm_builder's minimum pip to 23 so strict dependencies use the prebuilt wheel cache; released in Charmcraft 2.5.4. | |
| #1716 feat: upgrade minimum pip version | charmcraft | merged | Merged in canonical/charmcraft#1716 (def89c50), raising Charmcraft's minimum required pip version; the update was backported to 2.x by #1723 (5e119c36). | |
| #1389 'charm-strict-dependencies' requires at least one requirements file. in field 'parts.charm.charm-strict-dependencies' | charmcraft | closed | Merged #1808 (0d3b2713) to remove early requirements-file existence checks, although the reporter said explicitly listed files still failed in Charmcraft 2.7.3. | |
| #1801 Cannot replicate build behaviour from charmcraft v2 to v3 | charmcraft | closed | Closed as intended: v3's two-stage dependency handling remains unchanged; maintainers recommended charm-strict-dependencies: true for a single pip resolution. | |
| #1781 charmcraft `3.1.1` "successfully" packs charm, but python packages are missing in the venv | charmcraft | closed | 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). | |
| #1892 fix(charm_builder): force-install pip | charmcraft | merged | Merged PR #1892 (358657b6) added a Charmcraft 3.x hotfix to force-upgrade an insufficient pip in existing venvs, fixing #1456. | |
| #470 [REGRESSION] charmcraft not installing dependencies from requirements.txt anymore | charmcraft | closed | Fixed by merged PR #472 (commit 57b74577, "build: include venv in prime if charm-requirements defined"), which restored requirements.txt deps appearing in packed charms; maintainer closed after release in edge. | |
| #342 When installing requirements, pip should avoid using wheels | charmcraft | closed | Fixed in Charmcraft 1.3 by merged PR #541 (commit 0d14d8a2), which disabled binary packages so dependencies are built from source during charm packing. |