Reporter closed it themselves as not a charmcraft bug: maintainer facundobatista showed a workaround (override-build writing /etc/xdg/pip/pip.conf for the private index, plus charm-binary-python-packages), confirmed working.
Resolution: closed not a bug
Reason: The reporter closed the issue after confirming the workaround: maintainer @facundobatista proposed using parts.charm.override-build to write a pip.conf (index-url/extra-index-url, trusted-host) and charm-binary-python-packages for the prebuilt cryptography wheel; the reporter replied "Looks like it works!" and stated "I am going to close this issue since it's not really an issue with charmcraft". No code change was made in charmcraft.
Evaluated by:mr-cal-bot
No scores available.
Issue body
### Description
I am trying to pack a charm that depends on a Python package (in sdist format) from a [private PyPI server](https://pypi.org/project/pypiserver/), but charmcraft is failing to build the [`cryptography`](https://cryptography.io/en/latest/) Python package (a dependency of the private package) due to `libffi-dev` not being available in the LXD packing instance.
The error is thrown when trying to build the Python package [`cffi`](https://cffi.readthedocs.io/en/latest/) from sdist format because it cannot find the C header file `ffi.h` in the LXD instance.
### `charmcraft`, `lxd`, and `snapd` version
```
$ snap list charmcraft
Name Version Rev Tracking Publisher Notes
charmcraft 2.0.0 1033 latest/stable canonical✓ classic
```
```
$ snap list lxd
Name Version Rev Tracking Publisher Notes
lxd 5.5-37534be 23537 latest/stable canonical✓ -
```
```
$ snap list snapd
Name Version Rev Tracking Publisher Notes
snapd 2.56.2 16292 latest/stable canonical✓ snapd
```
### Stacktrace
<details>
<summary>Click to see stacktrace</summary>
```log
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.257 :: 2022-09-06 21:38:07.035 :: Collecting cryptography
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.257 :: 2022-09-06 21:38:07.038 :: Using cached cryptography-37.0.4.tar.gz (585 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.257 :: 2022-09-06 21:38:07.171 :: Installing build dependencies: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.257 :: 2022-09-06 21:38:27.251 :: Installing build dependencies: finished with status 'error'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.257 :: 2022-09-06 21:38:27.251 :: ERROR: Command errored out with exit status 1:
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.257 :: 2022-09-06 21:38:27.251 :: 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-kb0_cvn0/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url http://10.152.28.227:8080 --trusted-host 10.152.28.227 -- 'setuptools>=40.6.0,!=60.9.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: cwd: None
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Complete output (102 lines):
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Looking in indexes: https://pypi.org/simple, http://10.152.28.227:8080
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Collecting setuptools!=60.9.0,>=40.6.0
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Using cached setuptools-65.3.0.tar.gz (2.6 MB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Getting requirements to build wheel: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Getting requirements to build wheel: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Installing backend dependencies: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Installing backend dependencies: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Preparing wheel metadata: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Preparing wheel metadata: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Collecting wheel
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Using cached wheel-0.37.1.tar.gz (66 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.258 :: 2022-09-06 21:38:27.251 :: Collecting cffi>=1.12
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Using cached cffi-1.15.1.tar.gz (508 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Collecting setuptools-rust>=0.11.4
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Using cached setuptools-rust-1.5.1.tar.gz (24 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Installing build dependencies: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Installing build dependencies: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Getting requirements to build wheel: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Getting requirements to build wheel: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Installing backend dependencies: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.259 :: 2022-09-06 21:38:27.251 :: Installing backend dependencies: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Preparing wheel metadata: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Preparing wheel metadata: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Collecting pycparser
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Using cached pycparser-2.21.tar.gz (170 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Collecting semantic-version<3,>=2.8.2
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Using cached semantic_version-2.10.0.tar.gz (52 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Collecting typing-extensions>=3.7.4.3
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Using cached typing_extensions-4.3.0.tar.gz (47 kB)
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.260 :: 2022-09-06 21:38:27.251 :: Installing build dependencies: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Installing build dependencies: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Getting requirements to build wheel: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Getting requirements to build wheel: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Preparing wheel metadata: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Preparing wheel metadata: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Skipping wheel build for wheel, due to binaries being disabled for it.
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Skipping wheel build for cffi, due to binaries being disabled for it.
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.251 :: Skipping wheel build for pycparser, due to binaries being disabled for it.
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.261 :: 2022-09-06 21:38:27.252 :: Skipping wheel build for semantic-version, due to binaries being disabled for it.
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.262 :: 2022-09-06 21:38:27.252 :: Building wheels for collected packages: setuptools, setuptools-rust, typing-extensions
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.262 :: 2022-09-06 21:38:27.252 :: Building wheel for setuptools (PEP 517): started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.262 :: 2022-09-06 21:38:27.252 :: Building wheel for setuptools (PEP 517): finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.262 :: 2022-09-06 21:38:27.252 :: Created wheel for setuptools: filename=setuptools-65.3.0-py3-none-any.whl size=1232493 sha256=f1f3b5157b06f9aa13a95a1d6ab1f9803b6337333a53ad975912f28386fcd5c2
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.382 :: 2022-09-06 21:38:27.252 :: Stored in directory: /root/.cache/pip/wheels/d1/91/f4/517c55cb5dabfb5058ebf960ba998d02b59f78740f3c9914a6
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.383 :: 2022-09-06 21:38:27.252 :: Building wheel for setuptools-rust (PEP 517): started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.383 :: 2022-09-06 21:38:27.252 :: Building wheel for setuptools-rust (PEP 517): finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.383 :: 2022-09-06 21:38:27.252 :: Created wheel for setuptools-rust: filename=setuptools_rust-1.5.1-py3-none-any.whl size=23520 sha256=1be269d92f3b3109242b5504867174160e2771b03246a86b0dc3587c324b4df6
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.383 :: 2022-09-06 21:38:27.252 :: Stored in directory: /root/.cache/pip/wheels/ad/b1/bd/a7e02da5c5b825fa4ad806c468d79ceab842a02918be28dfd0
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.384 :: 2022-09-06 21:38:27.252 :: Building wheel for typing-extensions (PEP 517): started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.384 :: 2022-09-06 21:38:27.252 :: Building wheel for typing-extensions (PEP 517): finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.384 :: 2022-09-06 21:38:27.252 :: Created wheel for typing-extensions: filename=typing_extensions-4.3.0-py3-none-any.whl size=25596 sha256=4e110e067718fa35420fa8739d968edfacd2bb6b4988923875ba9406ad40d7c2
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.384 :: 2022-09-06 21:38:27.252 :: Stored in directory: /root/.cache/pip/wheels/00/53/4a/cba1742073c40c0f2053b20393f4bb92b824d338ec493e96fd
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.384 :: 2022-09-06 21:38:27.252 :: Successfully built setuptools setuptools-rust typing-extensions
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.384 :: 2022-09-06 21:38:27.252 :: Installing collected packages: setuptools, wheel, pycparser, cffi, semantic-version, typing-extensions, setuptools-rust
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.385 :: 2022-09-06 21:38:27.252 :: Running setup.py install for wheel: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.385 :: 2022-09-06 21:38:27.252 :: Running setup.py install for wheel: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.385 :: 2022-09-06 21:38:27.252 :: Running setup.py install for pycparser: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.385 :: 2022-09-06 21:38:27.252 :: Running setup.py install for pycparser: finished with status 'done'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.385 :: 2022-09-06 21:38:27.252 :: Running setup.py install for cffi: started
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: Running setup.py install for cffi: finished with status 'error'
2022-09-06 17:52:52.005 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: ERROR: Command errored out with exit status 1:
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: command: /root/parts/charm/build/staging-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pbuab8iy/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pbuab8iy/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-v8yfaml6/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-kb0_cvn0/overlay --compile --install-headers /root/parts/charm/build/staging-venv/include/site/python3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: cwd: /tmp/pip-install-pbuab8iy/cffi/
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: Complete output (36 lines):
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: running install
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.391 :: 2022-09-06 21:38:27.252 :: running build
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: running build_py
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: creating build
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: creating build/lib.linux-x86_64-3.8
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: creating build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.392 :: 2022-09-06 21:38:27.252 :: copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.393 :: 2022-09-06 21:38:27.252 :: copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.394 :: 2022-09-06 21:38:27.252 :: copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.394 :: 2022-09-06 21:38:27.252 :: copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.396 :: 2022-09-06 21:38:27.252 :: copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.397 :: 2022-09-06 21:38:27.252 :: copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.397 :: 2022-09-06 21:38:27.252 :: copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.397 :: 2022-09-06 21:38:27.252 :: copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.397 :: 2022-09-06 21:38:27.252 :: copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.397 :: 2022-09-06 21:38:27.252 :: copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.397 :: 2022-09-06 21:38:27.252 :: running build_ext
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: building '_cffi_backend' extension
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: creating build/temp.linux-x86_64-3.8
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: creating build/temp.linux-x86_64-3.8/c
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/root/parts/charm/build/staging-venv/include -I/usr/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: 15 | #include <ffi.h>
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: | ^~~~~~~
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: compilation terminated.
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.398 :: 2022-09-06 21:38:27.252 :: ----------------------------------------
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.399 :: 2022-09-06 21:38:27.252 :: ERROR: Command errored out with exit status 1: /root/parts/charm/build/staging-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pbuab8iy/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pbuab8iy/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-v8yfaml6/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-kb0_cvn0/overlay --compile --install-headers /root/parts/charm/build/staging-venv/include/site/python3.8/cffi Check the logs for full command output.
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.399 :: 2022-09-06 21:38:27.252 :: ----------------------------------------
2022-09-06 17:52:52.006 :: 2022-09-06 21:38:27.399 :: 2022-09-06 21:38:27.327 :: 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-kb0_cvn0/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url http://10.152.28.227:8080 --trusted-host 10.152.28.227 -- 'setuptools>=40.6.0,!=60.9.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4' Check the logs for full command output.
```
</details>
### Steps to reproduce
1. Add `cryptography` to `requirements.txt` file for charm.
2. Run `charmcraft -v pack`.
### Potential resolution
Install `cffi` as binary wheel rather than sdist using *charm-binary-python-packages* in the `charmcraft.yaml` file.
### Future enhancements?
It would be nice if `charmcraft.yaml` supported pulling Python packages in wheel (binary) format from private Python package repositories and not just from pypi.org. i.e. support pip options such as `--trusted-host` and `--extra-index-url`.
Another potential enhancement could be allowing charm developers to specify build and/or stage packages that need to be pulled via `apt`. Could be similar to how `snapcraft` does it?
### Attachments
* Log file for failed charm packing. [charmcraft-failed-pack.log](https://github.com/canonical/charmcraft/files/9506697/charmcraft-failed-pack.log)
Evaluation history
Date
Model
Scores
Action
Summary
stealth/space-bunny-alpha
—
closed not a bug
Reporter closed it themselves as not a charmcraft bug: maintainer facundobatista showed a workaround (override-build writing /etc/xdg/pip/pip.conf for the private index, plus charm-binary-python-packages), confirmed working.
stealth/space-bunny-alpha
—
closed not a bug
Closed as a configuration issue, not a Charmcraft defect: override-build with /etc/xdg/pip/pip.conf and charm-binary-python-packages enabled the reporter's private-index build.
qwen3.6-35b-a3b-mtp-q6
—
—
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.
qwen/qwen3.6-35b-a3b
—
—
Resolved as a configuration issue. Maintainer suggested using override-build in charmcraft.yaml to configure pip and charm-binary-python-packages for pre-installed wheels. Author verified the workaround and closed the issue, noting plans to update documentation.
qwen3.6-35b-a3b-mtp-q6
—
—
Closed as resolved. The author confirmed that configuring pip via the override-build hook in charmcraft.yaml bypasses the missing libffi-dev dependency and enables private PyPI access. The problem was identified as a configuration workaround.