← Back to issue list

Cannot replicate build behaviour from charmcraft v2 to v3

View original Github issue

Metadata

Project
charmcraft
Number
#1801
Type
issue
State
closed
Author
kian99
Labels
—
Created
Updated
Closed

Current evaluation

Closed as intended: v3's two-stage dependency handling remains unchanged; maintainers recommended charm-strict-dependencies: true for a single pip resolution.

Resolution: closed not a bug

Reason: In the closing maintainer comment, @lengau confirmed the changed behavior was intentional because the previous mechanism caused other build failures. They recommended charm-strict-dependencies: true to resolve all requirements in one pip command.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description When building a charm that contains the python `cryptography` lib in requirements.txt, I'm unable to replicate the behaviour from v2 to v3. A portion of my `requirements.txt` file: ``` cryptography == 42.0.7 ``` My `charmcraft.yaml` file contains: ``` type: "charm" parts: charm: charm-python-packages: [setuptools] charm-binary-python-packages: - cryptography ``` When building with charmcraft v2 I see the following output: ``` pip', 'install', '--no-binary=Jinja2,charmhelpers,cosl,hvac,ops,pip,pydantic,pytest-interface-tester,requests,setuptools,wheel', '--requirement=requirements.txt', 'PyYAML', 'attrs', 'importlib-resources', 'pip', 'pydantic', 'pydantic-core', 'pydantic<2.0', 'setuptools', 'urllib3', 'wheel', 'zipp'] 2024-08-02 17:33:06.516 :: :: Collecting cryptography==42.0.7 (from -r requirements.txt (line 5)) 2024-08-02 17:33:06.520 :: :: Downloading cryptography-42.0.7-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (5.3 kB) ``` When building with charmcraft v3 I see: ``` 2024-08-08 18:54:21.960 :: 2024-08-08 18:54:06.235 :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', 'PyYAML', 'attrs', 'cryptography', 'importlib-resources', 'jsonschema', 'pydantic-core', 'urllib3', 'zipp'] 2024-08-08 18:54:21.960 :: 2024-08-08 18:54:08.623 :: :: Successfully installed PyYAML-6.0.2 attrs-24.2.0 cffi-1.17.0 cryptography-43.0.0 importlib-resources-6.4.0 jsonschema-4.23.0 jsonschema-specifications-2023.12.1 pycparser-2.22 pydantic-core-2.21.0 referencing-0.35.1 rpds-py-0.20.0 typing-extensions-4.12.2 urllib3-2.2.2 zipp-3.19.2 2024-08-08 18:54:21.960 :: 2024-08-08 18:54:08.626 :: :: ... 2024-08-08 18:54:21.960 :: 2024-08-08 18:54:09.317 :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--no-binary=:all:', '--requirement=requirements.txt', 'pydantic', 'pydantic<2.0'] ... 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:39.147 :: :: Collecting cryptography==42.0.7 (from -r requirements.txt (line 5)) 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:39.150 :: :: Using cached cryptography-42.0.7.tar.gz (671 kB) 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:39.308 :: :: Installing build dependencies: started 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.391 :: :: Installing build dependencies: finished with status 'error' 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: error: subprocess-exited-with-error 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: × pip subprocess to install build dependencies did not run successfully. 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: │ exit code: 1 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: ╰─> [74 lines of output] 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: Collecting setuptools>=61.0.0 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: Using cached setuptools-72.1.0-py3-none-any.whl 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.397 :: :: Collecting wheel 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Using cached wheel-0.44.0-py3-none-any.whl 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Collecting cffi>=1.12 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Using cached cffi-1.17.0.tar.gz (516 kB) 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Installing build dependencies: started 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Installing build dependencies: finished with status 'done' 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Getting requirements to build wheel: started 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Getting requirements to build wheel: finished with status 'done' 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Preparing metadata (pyproject.toml): started 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Preparing metadata (pyproject.toml): finished with status 'done' 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Collecting setuptools-rust>=1.7.0 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Using cached setuptools_rust-1.10.1-py3-none-any.whl 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.398 :: :: Collecting pycparser (from cffi>=1.12) 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: Using cached pycparser-2.22-py3-none-any.whl 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: Collecting semantic-version<3,>=2.8.2 (from setuptools-rust>=1.7.0) 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: Using cached semantic_version-2.10.0-py2.py3-none-any.whl 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: Building wheels for collected packages: cffi 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: Building wheel for cffi (pyproject.toml): started 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: Building wheel for cffi (pyproject.toml): finished with status 'error' 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: error: subprocess-exited-with-error 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: 2024-08-08 18:16:43.327 :: 2024-08-08 18:16:42.399 :: :: × Building wheel for cffi (pyproject.toml) did not run successfully. ``` It seems with the new additional `pip install --no-binary=:all: --requirement=requirements.txt` command, that cryptography's build dependencies are attempting to be installed but I already specified it as a binary. Is there any way to replicate the v2 behavior? ### To Reproduce Pack a charm with `cryptography` in requirements.txt and include it in charm-binary-python-packages in charmcraft.yaml, ### Environment Building in a LXD 22.04 container. ### charmcraft.yaml ```shell type: "charm" parts: charm: charm-python-packages: [setuptools] charm-binary-python-packages: - cryptography - jsonschema - PyYAML - attrs - importlib-resources - urllib3 - zipp - pydantic-core bases: - build-on: - name: "ubuntu" channel: "22.04" architectures: - amd64 run-on: - name: "ubuntu" channel: "22.04" architectures: - amd64 ``` ### Relevant log output Added above.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed as intended: v3's two-stage dependency handling remains unchanged; maintainers recommended charm-strict-dependencies: true for a single pip resolution.
stealth/space-bunny-alpha — closed not a bug Charmcraft v3’s changed requirements handling was confirmed intentional. Set charm-strict-dependencies: true to use a single pip resolution instead of the v2 two-stage installation.
stealth/space-bunny-alpha — closed not a bug Closed as intentional: Charmcraft 3’s additional source-only pip step replaced v2 behavior that caused other build failures. Maintainer recommended charm-strict-dependencies: true for one-pass resolution.
qwen3.6-35b-a3b-mtp-q6 — — The v3 build behavior change is intentional, not a bug. The v2 approach caused other failures. Enable charm-strict-dependencies: true in the charm part to enforce single pip resolution and replicate desired behavior.
qwen/qwen3.6-35b-a3b — — Closed as intentional. The v3 change was kept to prevent other build failures. Use charm-strict-dependencies: true in charmcraft.yaml to run a single pip command and let pip resolve dependencies instead.
qwen/qwen3.6-35b-a3b — — Closed as intentional. The v3 dependency handling change was deliberate to prevent other build failures. Users should set charm-strict-dependencies: true in the charm part to use a single pip command and resolve dependencies correctly.
qwen3.6-35b-a3b-mtp-q6 — — Closed as intentional. Charmcraft v3 altered dependency handling, causing the reported failure. Maintainers recommend enabling charm-strict-dependencies in charmcraft.yaml for a single pip command and proper resolution instead of replicating v2 behavior.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#1306 (confidence 90%)

    Merged strict dependency management that introduced the recommended charm-strict-dependencies option.

Related issues

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