← 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: Focal's old setuptools broke pip's wheel installation. Preinstalling setuptools via charm-python-packages works around it; #923 tracked the same regression.

Resolution: closed not a bug

Reason: The closing maintainer identified a conflict between Focal's old setuptools and current libraries, not a Charmcraft or GCP defect. The concrete workaround was to add setuptools to parts.charm.charm-python-packages.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed not a bug Closed as not a Charmcraft bug: Focal's old setuptools broke pip's wheel installation. Preinstalling setuptools via charm-python-packages works around it; #923 tracked the same regression.
stealth/space-bunny-alpha — closed not a bug Closed as not a Charmcraft bug: pip could not install wheel due to Focal’s outdated setuptools; users could pre-install setuptools through charm-python-packages.
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.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#923 (confidence 100%)

    Reported the same charm-packing failure beyond GCP and led to upstream wheel regression #487.

  • Related To: operator#851 (confidence 99%)

    Contained the setuptools pre-installation workaround cited in the report.

  • Caused By: wheel#487 (confidence 90%)

    Upstream wheel regression associated with the packing failure tracked in charmcraft#923.

Related issues

Issue Project State Summary Similarity
#738 Crash with `charmcraft pack` charmcraft closed Closed as an upstream Jinja2/setuptools packaging interaction; removing Jinja2 or preinstalling newer pip and setuptools through charm-python-packages restored packing.
75%
#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%
#587 Charm packing error not logged charmcraft closed Missing pip errors were already logged by Charmcraft 1.3+90.g5e5efc7, so the report was closed as already resolved.
72%
#566 Error when building with charmcraft from edge charmcraft closed Closed by facundobatista as a duplicate of #551 (Jinja2/setuptools packing failure in 1.3 edge). Resolved via merged PR #553 (ccec8b7e, commit 4b2d291b) adding charm-python-packages; workaround is adding setuptools/pip.
71%
#615 Can't pip install charmcraft on latest Ubuntu charmcraft closed Closed through documentation: PR #691 (commit 8204c111) added PyPI installation instructions after the reporter confirmed pip installation itself succeeded.
71%