Can't pip install charmcraft on latest Ubuntu
Metadata
Current evaluation
Closed. PyPI installation instructions were added to the README to resolve pip install failures on newer Ubuntu versions caused by python-apt dependency conflicts.
Suggested action: —
No scores available.
Issue body
As mentioned in https://github.com/canonical/charmcraft/pull/487#issuecomment-894529408 , trying to pull any version of charmcraft newer than 1.0.0 with pip on Ubuntu series newer than Focal will fail with
```
Collecting python-apt
Using cached python-apt-0.7.8.tar.bz2 (49 kB)
ERROR: Command errored out with exit status 1:
command: /home/lourot/Documents/git/canonical/charm-nova-compute-nvidia-vgpu/.tox/build/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bpzx9t64/python-apt_dae4b8816222415991bfc123d7d1dab9/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bpzx9t64/python-apt_dae4b8816222415991bfc123d7d1dab9/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-qulkv83y
cwd: /tmp/pip-install-bpzx9t64/python-apt_dae4b8816222415991bfc123d7d1dab9/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-bpzx9t64/python-apt_dae4b8816222415991bfc123d7d1dab9/setup.py", line 6, in <module>
from DistUtilsExtra.command import *
ModuleNotFoundError: No module named 'DistUtilsExtra'
```
The solution would be to install a much newer version of `python-apt` on your system with `sudo apt install python-apt`, however this is not possible anymore on Ubuntu series newer than Focal: there only `python3-apt` can be apt-installed, and it doesn't get picked up because charmcraft has a dependency to `python-apt`, not `python3-apt`.
The only workaround I found so far is to also `pip install` the latest `python-apt` by adding this to my `build-requirements.txt`:
```
git+https://salsa.debian.org/apt-team/python-apt.git#egg=python-apt
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed. PyPI installation instructions were added to the README to resolve pip install failures on newer Ubuntu versions caused by python-apt dependency conflicts. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after maintainers added PyPI installation instructions to the README. The python-apt dependency conflict on newer Ubuntu versions was addressed via documentation updates instead of a code fix. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without code changes. Resolution involved updating the README with official PyPI installation instructions to resolve the python-apt dependency conflict on newer Ubuntu versions. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without code changes. Maintainers resolved the issue by adding official PyPI installation instructions to the README, addressing pip dependency conflicts on newer Ubuntu versions. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #816 pip install charmcraft installs v1.0 | charmcraft | closed | Closed as expected behavior. Python 3.6 on Ubuntu 18.04 forced pip to install an older compatible version due to dependency constraints. Resolved after the user upgraded to Ubuntu Focal with Python 3.7+. | |
| #758 charmcraft installation via PIP started failing recently | charmcraft | closed | A newer craft-parts release broke compatibility with the pinned pydantic version, failing charmcraft pip installs. The issue was fixed by updating dependency constraints and merged in PR #765. | |
| #922 Unable to pack charms on a GCP instance | charmcraft | closed | 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. |