Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to pack charms on a GCP instance #922

Closed
sed-i opened this issue Nov 4, 2022 · 3 comments
Closed

Unable to pack charms on a GCP instance #922

sed-i opened this issue Nov 4, 2022 · 3 comments

Comments

@sed-i
Copy link
Contributor

sed-i commented Nov 4, 2022

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.
@hloeung
Copy link

hloeung commented Nov 8, 2022

@sed-i
Copy link
Contributor Author

sed-i commented Nov 15, 2022

Workaround mentioned in canonical/operator#851.

@facundobatista
Copy link
Contributor

Hello! Thanks for the report!

As it's mentioned in the Operator issue, the problem here is pip failing to install wheels because of a setuptools version.

It's not a Charmcraft issue, but more a "misunderstanding" between the old setuptools installed in Focal and latest version of the other libraries. That's why the workaround: pre-install setuptool (which will result in an update to latest version):

parts:
  charm:
    charm-python-packages: [setuptools]

More info in this forum post.

Closing this issue, then. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants