Hello, when I add, for example, “paramiko” in requirements.txt file, does anyone know why I get error? (if I delete “paramiko” from requirements.txt file and I execute “charmcraft pack”, it works correctly). Thanks!
Not sure. Maybe paste some logs.
Run charmcraft build --debug
Also, paste your charmcraft.yaml or even better link to your repo.
Hi, here you have my repo: https://github.com/agalvan002/Juju
If I run charmcraft pack --debug, it takes a lot of time so I run charmcraft pack. Inside my repo there are some logs.
I could reproduce your error:
erik@pixel:~ > git clone git@github.com:agalvan002/Juju.git
Cloning into 'Juju'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 24 (delta 2), reused 24 (delta 2), pack-reused 0
Receiving objects: 100% (24/24), 12.94 KiB | 1.85 MiB/s, done.
Resolving deltas: 100% (2/2), done.
erik@pixel:~ > cd Juju
erik@pixel:~/Juju > charmcraft build
Failed to build charm for bases index '0'.
Full execution log: '/home/erik/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220317-181935.944405.log'
erik@pixel:~/Juju >
Seems it gets into preoblem
Installing collected packages: setuptools, wheel, pycparser, cffi 2022-03-17 18:43:47.895 :: 2022-03-17 17:43:47.891 :: 2022-03-17 17:43:47.890 :: Running setup.py install for wheel: started 2022-03-17 18:43:47.896 :: 2022-03-17 17:43:47.894 :: 2022-03-17 17:43:47.890 :: Running setup.py install for wheel: finished with status 'done' 2022-03-17 18:43:47.897 :: 2022-03-17 17:43:47.896 :: 2022-03-17 17:43:47.891 :: Running setup.py install for pycparser: started 2022-03-17 18:43:47.898 :: 2022-03-17 17:43:47.896 :: 2022-03-17 17:43:47.891 :: Running setup.py install for pycparser: finished with status 'done' 2022-03-17 18:43:47.903 :: 2022-03-17 17:43:47.898 :: 2022-03-17 17:43:47.891 :: Running setup.py install for cffi: started 2022-03-17 18:43:47.904 :: 2022-03-17 17:43:47.903 :: 2022-03-17 17:43:47.891 :: Running setup.py install for cffi: finished with status 'error' 2022-03-17 18:43:47.904 :: 2022-03-17 17:43:47.903 :: 2022-03-17 17:43:47.891 :: ERROR: Command errored out with exit status 1: 2022-03-17 18:43:47.904 :: 2022-03-17 17:43:47.904 :: 2022-03-17 17:43:47.891 :: command: /root/parts/charm/build/staging-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kcii5uc2/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kcii5uc2/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-p6gh2apq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-7h7lj1jr/overlay --compile --install-headers /root/parts/charm/build/staging-venv/include/site/python3.8/cffi
More specifically.
2022-03-17 18:43:47.904 :: 2022-03-17 17:43:47.903 :: 2022-03-17 17:43:47.891 :: Running setup.py install for cffi: finished with status 'error'
You can try with
charmcraft build --verbose
Then you see more.
If I remove your package paramiko in requirements.txt the charm builds just fine. So, I think there is something that goes sideways with that package.
2022-03-17 18:52:23.606 :: 2022-03-17 17:52:23.280 execute action charm:Action(part_name='charm', step=Step.PRIME, action_type=ActionType.RUN, reason=None)
2022-03-17 18:52:24.055 :: 2022-03-17 17:52:23.605 Creating the package itself
2022-03-17 18:52:24.055 :: Created 'simple_ubuntu-20.04-amd64.charm'.
2022-03-17 18:52:24.055 :: Charms packed:
2022-03-17 18:52:24.057 :: simple_ubuntu-20.04-amd64.charm
2022-03-17 18:52:24.957 Executing on host: lxc --project charmcraft config device show local:charmcraft-simple-4857917-0-0-amd64
2022-03-17 18:52:26.237 Executing on host: lxc --project charmcraft config device remove local:charmcraft-simple-4857917-0-0-amd64 disk-/root/project
2022-03-17 18:52:27.146 Executing on host: lxc --project charmcraft stop local:charmcraft-simple-4857917-0-0-amd64
2022-03-17 18:52:29.061 Charm packed ok
erik@pixel:~/Juju >
Perhaps try with a specific version or figure out what goes wrong in the installation of that package.
I’m not sure, but maybe @cmatsuoka or @afreiberger might assist here.
The note in the log about not building CFFI wheel because binaries are disabled makes me think you need to specify cffi within your requirements.txt if you want to include paramiko.
I’ll note that there is a py3.5 version deprecation in cffi to be aware of. This may be useful:
# Build requirements
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.
I pulled this out of charm-designate, however I expect Ubuntu 20.04 should be building on py36, and your charmcraft.yaml only specifies 20.04, so you shouldn’t need anything version-specific for cffi other than specifically enabling it so it can be built with binaries.
(Caveat, I am not a python/packaging expert, this is just the process I’d go through to try to get this to build cleanly.)