← Back to issue list

Unable to pack charms on a GCP instance

View original Github issue

Metadata

Project
charmcraft
Number
#922
Type
issue
State
closed
Author
sed-i
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

No scores available.

Issue body

I am currently unable to pack charms on GCP on 22.04, with both charmcraft 1.7.1 and 2.1.0. ``` 2022-11-04 13:18:13.966 Packing the charm 2022-11-04 13:18:13.967 Running ['charmcraft', 'pack', '--bases-index', '0'] 2022-11-04 13:18:13.967 Emitter: Pausing control of the terminal 2022-11-04 13:18:47.529 Emitter: Resuming control of the terminal 2022-11-04 13:18:49.370 charmcraft internal error: PermissionError(13, 'Permission denied') 2022-11-04 13:18:49.383 Traceback (most recent call last): 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/commands/build.py", line 494, in pack_charm_in_instance 2022-11-04 13:18:49.383 instance.execute_run(cmd, check=True, cwd=instance_output_dir) 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/craft_providers/lxd/lxd_instance.py", line 221, in execute_run 2022-11-04 13:18:49.383 return self.lxc.exec( 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/craft_providers/lxd/lxc.py", line 307, in exec 2022-11-04 13:18:49.383 return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/usr/lib/python3.8/subprocess.py", line 516, in run 2022-11-04 13:18:49.383 raise CalledProcessError(retcode, process.args, 2022-11-04 13:18:49.383 subprocess.CalledProcessError: Command '['lxc', '--project', 'charmcraft', 'exec', 'local:charmcraft-cos-configuration-k8s-1554973-0-0-amd64', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'CHARMCRAFT_MANAGED_MODE=1', 'charmcraft', 'pack', '--bases-index', '0']' returned non-zero exit status 1. 2022-11-04 13:18:49.383 2022-11-04 13:18:49.383 The above exception was the direct cause of the following exception: 2022-11-04 13:18:49.383 Traceback (most recent call last): 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/commands/build.py", line 496, in pack_charm_in_instance 2022-11-04 13:18:49.383 raise CraftError( 2022-11-04 13:18:49.383 craft_cli.errors.CraftError: Failed to build charm for bases index '0'. 2022-11-04 13:18:49.383 2022-11-04 13:18:49.383 During handling of the above exception, another exception occurred: 2022-11-04 13:18:49.383 Traceback (most recent call last): 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/main.py", line 167, in main 2022-11-04 13:18:49.383 retcode = dispatcher.run() 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/craft_cli/dispatcher.py", line 406, in run 2022-11-04 13:18:49.383 return self._loaded_command.run(self._parsed_command_args) 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/commands/pack.py", line 137, in run 2022-11-04 13:18:49.383 self._pack_charm(parsed_args) 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/commands/pack.py", line 170, in _pack_charm 2022-11-04 13:18:49.383 charms = builder.run(parsed_args.bases_index, destructive_mode=build_args.destructive_mode) 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/commands/build.py", line 433, in run 2022-11-04 13:18:49.383 charm_name = self.pack_charm_in_instance( 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/commands/build.py", line 500, in pack_charm_in_instance 2022-11-04 13:18:49.383 capture_logs_from_instance(instance) 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/lib/charmcraft/providers/_logs.py", line 37, in capture_logs_from_instance 2022-11-04 13:18:49.383 tmp_file = tempfile.NamedTemporaryFile( 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/usr/lib/python3.8/tempfile.py", line 679, in NamedTemporaryFile 2022-11-04 13:18:49.383 (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type) 2022-11-04 13:18:49.383 File "/snap/charmcraft/978/usr/lib/python3.8/tempfile.py", line 389, in _mkstemp_inner 2022-11-04 13:18:49.383 fd = _os.open(file, flags, 0o600) 2022-11-04 13:18:49.383 PermissionError: [Errno 13] Permission denied: './charmcraft-50emw2j6-temporary.log' 2022-11-04 13:18:49.383 Full execution log: '/home/ubuntu/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20221104-131724.079709.log' ``` Also relevant: ``` 2022-11-04 13:30:58.348 :: :: Complete output (72 lines): 2022-11-04 13:30:58.348 :: :: Collecting setuptools>=40.8.0 2022-11-04 13:30:58.348 :: :: Using cached setuptools-65.5.0.tar.gz (2.6 MB) 2022-11-04 13:30:58.348 :: :: Getting requirements to build wheel: started 2022-11-04 13:30:58.349 :: :: Getting requirements to build wheel: finished with status 'done' 2022-11-04 13:30:58.349 :: :: Installing backend dependencies: started 2022-11-04 13:30:58.349 :: :: Installing backend dependencies: finished with status 'error' 2022-11-04 13:30:58.349 :: :: ERROR: Command errored out with exit status 1: 2022-11-04 13:30:58.351 :: :: command: /root/parts/charm/build/staging-venv/bin/python3 /root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-jbrcqjlv/normal --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- wheel 2022-11-04 13:30:58.352 :: :: cwd: None 2022-11-04 13:30:58.353 :: :: Complete output (60 lines): 2022-11-04 13:30:58.354 :: :: Collecting wheel 2022-11-04 13:30:58.355 :: :: Using cached wheel-0.38.1.tar.gz (66 kB) 2022-11-04 13:30:58.356 :: :: ERROR: Command errored out with exit status 1: 2022-11-04 13:30:58.358 :: :: command: /root/parts/charm/build/staging-venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-__sqo5az/wheel/setup.py'"'"'; __file__='"'"'/tmp/pip-install-__sqo5az/wheel/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-__sqo5az/wheel/pip-egg-info 2022-11-04 13:30:58.359 :: :: cwd: /tmp/pip-install-__sqo5az/wheel/ 2022-11-04 13:30:58.359 :: :: Complete output (52 lines): 2022-11-04 13:30:58.360 :: :: WARNING: The wheel package is not available. 2022-11-04 13:30:58.361 :: :: running egg_info 2022-11-04 13:30:58.361 :: :: creating /tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info 2022-11-04 13:30:58.362 :: :: writing /tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info/PKG-INFO 2022-11-04 13:30:58.362 :: :: writing dependency_links to /tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info/dependency_links.txt 2022-11-04 13:30:58.363 :: :: writing entry points to /tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info/entry_points.txt 2022-11-04 13:30:58.363 :: :: writing requirements to /tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info/requires.txt 2022-11-04 13:30:58.364 :: :: writing top-level names to /tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info/top_level.txt 2022-11-04 13:30:58.365 :: :: writing manifest file '/tmp/pip-install-__sqo5az/wheel/pip-egg-info/wheel.egg-info/SOURCES.txt' 2022-11-04 13:30:58.365 :: :: Traceback (most recent call last): 2022-11-04 13:30:58.366 :: :: File "<string>", line 1, in <module> 2022-11-04 13:30:58.367 :: :: File "/tmp/pip-install-__sqo5az/wheel/setup.py", line 5, in <module> 2022-11-04 13:30:58.368 :: :: setup() 2022-11-04 13:30:58.369 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup 2022-11-04 13:30:58.370 :: :: return distutils.core.setup(**attrs) 2022-11-04 13:30:58.372 :: :: File "/usr/lib/python3.8/distutils/core.py", line 148, in setup 2022-11-04 13:30:58.373 :: :: dist.run_commands() 2022-11-04 13:30:58.374 :: :: File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands 2022-11-04 13:30:58.375 :: :: self.run_command(cmd) 2022-11-04 13:30:58.376 :: :: File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command 2022-11-04 13:30:58.377 :: :: cmd_obj.run() 2022-11-04 13:30:58.385 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 296, in run 2022-11-04 13:30:58.390 :: :: self.find_sources() 2022-11-04 13:30:58.390 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 303, in find_sources 2022-11-04 13:30:58.390 :: :: mm.run() 2022-11-04 13:30:58.392 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 534, in run 2022-11-04 13:30:58.392 :: :: self.add_defaults() 2022-11-04 13:30:58.393 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults 2022-11-04 13:30:58.393 :: :: sdist.add_defaults(self) 2022-11-04 13:30:58.394 :: :: File "/usr/lib/python3.8/distutils/command/sdist.py", line 226, in add_defaults 2022-11-04 13:30:58.395 :: :: self._add_defaults_python() 2022-11-04 13:30:58.396 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/command/sdist.py", line 135, in _add_defaults_python 2022-11-04 13:30:58.397 :: :: build_py = self.get_finalized_command('build_py') 2022-11-04 13:30:58.397 :: :: File "/usr/lib/python3.8/distutils/cmd.py", line 299, in get_finalized_command 2022-11-04 13:30:58.397 :: :: cmd_obj.ensure_finalized() 2022-11-04 13:30:58.398 :: :: File "/usr/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized 2022-11-04 13:30:58.403 :: :: self.finalize_options() 2022-11-04 13:30:58.403 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/command/build_py.py", line 34, in finalize_options 2022-11-04 13:30:58.403 :: :: orig.build_py.finalize_options(self) 2022-11-04 13:30:58.404 :: :: File "/usr/lib/python3.8/distutils/command/build_py.py", line 43, in finalize_options 2022-11-04 13:30:58.404 :: :: self.set_undefined_options('build', 2022-11-04 13:30:58.405 :: :: File "/usr/lib/python3.8/distutils/cmd.py", line 286, in set_undefined_options 2022-11-04 13:30:58.405 :: :: src_cmd_obj = self.distribution.get_command_obj(src_cmd) 2022-11-04 13:30:58.405 :: :: File "/usr/lib/python3.8/distutils/dist.py", line 857, in get_command_obj 2022-11-04 13:30:58.405 :: :: klass = self.get_command_class(command) 2022-11-04 13:30:58.405 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/dist.py", line 834, in get_command_class 2022-11-04 13:30:58.409 :: :: self.cmdclass[command] = cmdclass = ep.load() 2022-11-04 13:30:58.409 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load 2022-11-04 13:30:58.410 :: :: return self.resolve() 2022-11-04 13:30:58.411 :: :: File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve 2022-11-04 13:30:58.411 :: :: module = __import__(self.module_name, fromlist=['__name__'], level=0) 2022-11-04 13:30:58.411 :: :: ModuleNotFoundError: No module named 'setuptools.command.build' 2022-11-04 13:30:58.412 :: :: ---------------------------------------- 2022-11-04 13:30:58.559 :: :: ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 2022-11-04 13:30:58.560 :: :: ---------------------------------------- 2022-11-04 13:30:58.561 :: :: ERROR: Command errored out with exit status 1: /root/parts/charm/build/staging-venv/bin/python3 /root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-jbrcqjlv/normal --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- wheel Check the logs for full command output. ```

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6 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.
qwen/qwen3.6-35b-a3b Closed as not a Charmcraft bug. The build failure stemmed from a setuptools version mismatch causing pip wheel installation errors. A workaround was provided to pre-install setuptools via charm-python-packages.
qwen3.6-35b-a3b-mtp-q6 Closed as not a Charmcraft bug. The failure stems from a setuptools version mismatch causing pip build errors. A workaround was provided: pre-install setuptools via charm-python-packages to resolve the conflict.
qwen3.6-35b-a3b-mtp-q6 Closed as not a Charmcraft bug. The error stems from a pip and setuptools version mismatch on Ubuntu Focal. Maintainers provided a workaround to pre-install setuptools via charm-python-packages in charmcraft.yaml.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#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.
78%
#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.
76%
#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.
74%
#923 Suddenly I can not pack charms charmcraft closed Charm packing failed due to a setuptools upgrade triggered by a wheel package change. Users applied workarounds like pinning wheel<0.38.2 or using the charm/2.x/stable snap. The issue was resolved after the upstream wheel package was fixed.
74%
#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.
74%
#879 pack command succeeds without copying charm charmcraft closed Closed. The pack command failure stems from outdated setuptools and pip in the charm tool, tracked externally, and charmcraft failing to detect build errors, already resolved in version 2.1.
73%
#1931 Successfully pack charm with incorrect charm.py file permission charmcraft open charmcraft pack succeeds even when src/charm.py lacks the execute bit, producing a charm that fails at deploy with 'Permission denied'. Requested a warning/error or auto-fix at pack time. No maintainer activity; an entrypoint linter now exists but only runs via charmcraft analyze, not pack.
73%
#858 Cannot install cryptography Python package as sdist using `charmcraft -v pack` charmcraft closed Closed as not a bug. Resolved via workaround using override-build in charmcraft.yaml to configure pip and specify charm-binary-python-packages. Author plans to document the override-build feature.
73%
#632 Cant build charm with charmhelpers - missing markupsafe charmcraft closed 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.
72%