← Back to issue list

Cant build charm with charmhelpers - missing markupsafe

View original Github issue

Metadata

Project
charmcraft
Number
#632
Type
issue
State
closed
Author
erik78se
Labels
—
Created
Updated
Closed

Current evaluation

Charmhelpers-based charm build failed with missing markupsafe via Jinja2/setuptools 58+ vs Tempita 2to3 conflict. cmatsuoka diagnosed it and the reporter confirmed the workaround works; maintainer closed the issue as solved without a charmcraft code change.

Resolution: closed not a bug

Reason: cmatsuoka explained the failure is a dependency-version conflict (jinja2 needs setuptools >58 while Tempita, via charmhelpers, breaks on setuptools 58+ due to dropped 2to3) rather than a charmcraft defect, and closed on 2022-01-27 once the reporter confirmed adding `charm-python-packages: [setuptools < 58]` to charmcraft.yaml fixed the build. No fix PR was merged; the pre-existing `charm-python-packages` property from PR #553 (ccec8b7e) is the intended escape hatch.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I'm trying to build my charm: https://github.com/erik78se/juju-operators-examples/tree/main/metrics-nrpe branch: nrpe `charmcraft from snap version 1.4.0 stable` requirement.txt ``` ops >= 1.3.0 psutil==5.9.0 charmhelpers==0.20.24 ``` But I run into this issue which I have no clue on how to resolve. I'm stuck here. `charmcraft build -v` 2022-01-22 19:05:01.178 :: 2022-01-22 18:05:01.096 :: 2022-01-22 18:05:00.814 :: Preparing wheel metadata: started 2022-01-22 19:05:01.182 :: 2022-01-22 18:05:01.178 :: 2022-01-22 18:05:01.096 :: Preparing wheel metadata: finished with status 'done' 2022-01-22 19:05:01.444 :: 2022-01-22 18:05:01.181 :: 2022-01-22 18:05:01.177 :: Collecting Jinja2==3.0.3 2022-01-22 19:05:01.444 :: 2022-01-22 18:05:01.440 :: 2022-01-22 18:05:01.181 :: Using cached Jinja2-3.0.3.tar.gz (269 kB) 2022-01-22 19:05:01.444 :: 2022-01-22 18:05:01.441 :: 2022-01-22 18:05:01.440 :: ERROR: Command errored out with exit status 1: 2022-01-22 19:05:01.444 :: 2022-01-22 18:05:01.441 :: 2022-01-22 18:05:01.440 :: command: /root/parts/charm/build/staging-venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8hz6tk78/Jinja2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8hz6tk78/Jinja2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-8hz6tk78/Jinja2/pip-egg-info 2022-01-22 19:05:01.445 :: 2022-01-22 18:05:01.441 :: 2022-01-22 18:05:01.440 :: cwd: /tmp/pip-install-8hz6tk78/Jinja2/ 2022-01-22 19:05:01.445 :: 2022-01-22 18:05:01.441 :: 2022-01-22 18:05:01.440 :: Complete output (35 lines): 2022-01-22 19:05:01.445 :: 2022-01-22 18:05:01.441 :: 2022-01-22 18:05:01.441 :: Traceback (most recent call last): 2022-01-22 19:05:01.445 :: 2022-01-22 18:05:01.441 :: 2022-01-22 18:05:01.441 :: File "<string>", line 1, in <module> 2022-01-22 19:05:01.445 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: File "/tmp/pip-install-8hz6tk78/Jinja2/setup.py", line 4, in <module> 2022-01-22 19:05:01.445 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: setup( 2022-01-22 19:05:01.448 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: return distutils.core.setup(**attrs) 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: File "/usr/lib/python3.8/distutils/core.py", line 121, in setup 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: dist.parse_config_files() 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/dist.py", line 701, in parse_config_files 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: parse_configuration(self, self.command_options, 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.442 :: 2022-01-22 18:05:01.441 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 121, in parse_configuration 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: meta.parse() 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 426, in parse 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: section_parser_method(section_options) 2022-01-22 19:05:01.449 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 399, in parse_section 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: self[name] = value 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 184, in __setitem__ 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: value = parser(value) 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 515, in _parse_version 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.443 :: 2022-01-22 18:05:01.442 :: version = self._parse_attr(value, self.package_dir) 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.442 :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 349, in _parse_attr 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.442 :: module = import_module(module_name) 2022-01-22 19:05:01.450 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.443 :: File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.443 :: return _bootstrap._gcd_import(name[level:], package, level) 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.443 :: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.443 :: File "<frozen importlib._bootstrap>", line 991, in _find_and_load 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.444 :: 2022-01-22 18:05:01.443 :: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.445 :: 2022-01-22 18:05:01.443 :: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.446 :: 2022-01-22 18:05:01.443 :: File "<frozen importlib._bootstrap_external>", line 848, in exec_module 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.446 :: 2022-01-22 18:05:01.443 :: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.446 :: 2022-01-22 18:05:01.443 :: File "/tmp/pip-install-8hz6tk78/Jinja2/src/jinja2/__init__.py", line 8, in <module> 2022-01-22 19:05:01.451 :: 2022-01-22 18:05:01.450 :: 2022-01-22 18:05:01.443 :: from .environment import Environment as Environment 2022-01-22 19:05:01.452 :: 2022-01-22 18:05:01.450 :: 2022-01-22 18:05:01.443 :: File "/tmp/pip-install-8hz6tk78/Jinja2/src/jinja2/environment.py", line 15, in <module> 2022-01-22 19:05:01.452 :: 2022-01-22 18:05:01.450 :: 2022-01-22 18:05:01.444 :: from markupsafe import Markup 2022-01-22 19:05:01.484 :: 2022-01-22 18:05:01.451 :: 2022-01-22 18:05:01.444 :: ModuleNotFoundError: No module named 'markupsafe' 2022-01-22 19:05:01.552 :: 2022-01-22 18:05:01.481 :: 2022-01-22 18:05:01.444 :: ---------------------------------------- 2022-01-22 19:05:01.553 :: 2022-01-22 18:05:01.552 :: 2022-01-22 18:05:01.480 :: ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Traceback (most recent call last): 2022-01-22 19:05:01.553 :: 2022-01-22 18:05:01.552 :: File "/snap/charmcraft/x5/lib/charmcra **UPDATE: If I remove charmhelpers, the build goes through. #charmhelpers==0.20.24** Whats the reason for this?

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Charmhelpers-based charm build failed with missing markupsafe via Jinja2/setuptools 58+ vs Tempita 2to3 conflict. cmatsuoka diagnosed it and the reporter confirmed the workaround works; maintainer closed the issue as solved without a charmcraft code change.
stealth/space-bunny-alpha — closed not a bug Charmcraft 1.4.0 build failed with missing markupsafe when charmhelpers pulled in jinja2/tempita. Maintainer traced it to a dependency conflict, not a charmcraft bug; pinning `charm-python-packages: [setuptools < 58]` in charmcraft.yaml fixed the reporter's build and the issue was closed.
stealth/space-bunny-alpha — closed resolved Resolved by pinning setuptools below 58 in charmcraft.yaml: charm-python-packages: [setuptools < 58]. The reporter confirmed the workaround fixed the missing-markupsafe build failure.
qwen3.6-35b-a3b-mtp-q6 — — Charm build failed due to a setuptools version conflict between Jinja2 and Tempita. Resolved by adding charm-python-packages: [setuptools < 58] to charmcraft.yaml. Issue closed as resolved.
qwen/qwen3.6-35b-a3b — — Resolved via charmcraft.yaml workaround. Adding charm-python-packages: [setuptools < 58] fixed a Jinja2 and Tempita dependency conflict. The issue was closed after the user confirmed the build succeeded.
qwen3.6-35b-a3b-mtp-q6 — — Closed after confirming a workaround. Charm builds failed due to a setuptools version conflict between Jinja2 and Tempita. Adding charm-python-packages: [setuptools < 58] to charmcraft.yaml resolved the dependency issue.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#553 (confidence 88%)

    PR #553 (commit ccec8b7e / 4b2d291b) added the charm-python-packages property that cmatsuoka recommended as the fix path, per related issue #551.

  • Duplicate Of: canonical/charmcraft#639 (confidence 78%)

    Same Jinja2/setuptools-driven build failure, closed with the same `charm-python-packages: [setuptools < 58]` config workaround.

  • Related To: canonical/charmcraft#551 (confidence 72%)

    Original issue where charm-python-packages was added to restore Jinja2 packing in charmcraft 1.3.

Related issues

Issue Project State Summary Similarity
#639 Can't build charm: Failed to build charm for bases index '0' charmcraft closed Closed as a dependency/configuration issue: adding setuptools fixed Jinja2 packing, while Tempita required setuptools <58. A later build recovered after charmcraft clean.
78%
#904 Can't build/pack a charm with Focal charmcraft closed Closed as an upstream charm-tools bug; the missing MarkupSafe failure was tracked in juju/charm-tools#646.
74%
#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.
72%
#792 22.10 - Failed to build charm for bases index '0'. charmcraft closed Reporter's reactive charm failed to build; maintainer facundobatista closed it as not a Charmcraft bug — the legacy `charm` tool rejects metadata.yaml without a `series` list. Author agreed and took it to the Juju team.
71%