Cant build charm with charmhelpers - missing markupsafe
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| 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 after the workaround was confirmed. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #639 Can't build charm: Failed to build charm for bases index '0' | charmcraft | closed | Resolved as a jinja2 and setuptools version conflict. Provided a charmcraft.yaml workaround to install or pin setuptools. A later user confirmed charmcraft clean followed by pack also fixed it. Closed without code changes. | |
| #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. | |
| #738 Crash with `charmcraft pack` | charmcraft | closed | Closed. The crash stemmed from outdated setuptools and pip failing to build jinja2. Resolved via a workaround specifying newer setuptools and pip in charmcraft.yaml. Maintainers attributed the error to upstream packaging and pip limitations. | |
| #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. | |
| #566 Error when building with charmcraft from edge | charmcraft | closed | Closed as a duplicate of #551. Resolved via a config workaround adding setuptools to charm-python-packages. A follow-up confirmed adding pip alongside setuptools fixed circular dependency build failures. |