Builds fail for 20.04 (in some common circumstances)
Metadata
Current evaluation
Fixed in canonical/charmcraft#2275 (commit 65d01ed5): charm builds now apply a bundled setuptools-scm constraint, avoiding the Python 3.8/3.9 all-source dependency cycle.
Resolution: closed resolved
Reason: Merged PR canonical/charmcraft#2275 added a charm-plugin PIP_CONSTRAINT and regression coverage for the setuptools-scm workaround. This prevents the upstream circular build dependency without requiring changes to affected charms.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
Due to https://github.com/pypa/setuptools-scm/issues/1131
If requirements.txt is used (and, I think, not the uv plugin, but YMMV)
If any non-trivial package is included (e.g. opentelemetry),
Because charmcraft builds everything from source,
The build-time dependency "install" thing ends up in a loop and fails.
Both Python 3.8 (EOL) and 3.9 (supported) are affected, let's wait for upstream.
Dep chain:
- opentelemetry-api
- hatchling (build dep)
- pluggy
- setuptools_scm
### To Reproduce
build on 20.04
add e.g. `opentelemetry-api` into `requirements.txt`
### Environment
default settings
### charmcraft.yaml
```yaml
type: charm
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
run-on:
- name: "ubuntu"
channel: "20.04"
parts:
charm:
build-packages:
- git
```
### Relevant log output
```shell
# Manual MRE
14:01:49
(code) ⋊> dima@bb ⋊> /code pip install --no-binary=:all: setuptools_scm 14:01:49
Collecting setuptools_scm
Using cached setuptools_scm-8.3.0.tar.gz (78 kB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [92 lines of output]
Collecting setuptools>=61
Using cached setuptools-79.0.0.tar.gz (1.4 MB)
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting tomli<=2.0.2
Using cached tomli-2.0.2.tar.gz (16 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting importlib-metadata>=4.6
Downloading importlib_metadata-8.6.1.tar.gz (55 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> [59 lines of output]
Collecting setuptools>=61.2
Using cached setuptools-79.0.0.tar.gz (1.4 MB)
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting setuptools_scm>=3.4.1 (from setuptools_scm[toml]>=3.4.1)
Using cached setuptools_scm-8.3.0.tar.gz (78 kB)
ERROR: Exception:
Traceback (most recent call last):
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 106, in _run_wrapper
status = _inner_run()
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 97, in _inner_run
return self.run(options, args)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
return func(self, options, args)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 386, in run
requirement_set = resolver.resolve(
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
File "/code/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/code/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/code/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
File "/code/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__
return bool(self._sequence)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 174, in __bool__
return any(self)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 162, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 53, in _iter_built
candidate = func()
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 187, in _make_candidate_from_link
base: Optional[BaseCandidate] = self._make_base_candidate_from_link(
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 233, in _make_base_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 304, in __init__
super().__init__(
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 159, in __init__
self.dist = self._prepare()
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 236, in _prepare
dist = self._prepare_distribution()
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 315, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 527, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 642, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 71, in _get_prepared_distribution
with build_tracker.track(req, tracker_id):
File "/home/dima/.local/share/uv/python/cpython-3.9.22-linux-x86_64-gnu/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/build_tracker.py", line 136, in track
self.add(req, tracker_id)
File "/code/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/build_tracker.py", line 102, in add
raise LookupError(message)
LookupError: https://files.pythonhosted.org/packages/ae/c1/0eb89ad8a0aa7033bbd0cc9fb44a0090c20edaba495f291e31be010e6ec1/setuptools_scm-8.3.0.tar.gz (from https://pypi.org/simple/setuptools-scm/) (requires-python:>=3.8) is already being built: setuptools_scm from https://files.pythonhosted.org/packages/ae/c1/0eb89ad8a0aa7033bbd0cc9fb44a0090c20edaba495f291e31be010e6ec1/setuptools_scm-8.3.0.tar.gz
[end of output]
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed in canonical/charmcraft#2275 (commit 65d01ed5): charm builds now apply a bundled setuptools-scm constraint, avoiding the Python 3.8/3.9 all-source dependency cycle. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed without a Charmcraft fix: Ubuntu 20.04 source builds hit upstream setuptools-scm #1131. Workarounds pin setuptools-scm below 8.2 or migrate to uv/poetry. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed with workarounds. Pin setuptools_scm < 8.2.0 via PIP_CONSTRAINT or PIP_BUILD_CONSTRAINT for Python < 3.10, or migrate to the uv or poetry plugins. The root cause is an upstream dependency cycle that remains unfixed. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Workarounds documented using PIP_CONSTRAINT or PIP_BUILD_CONSTRAINT to pin setuptools_scm < 8.2.0 for Python < 3.10. Team recommends migrating to the uv plugin or applying build constraints until upstream resolves the loop. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Resolved via workarounds for a setuptools_scm dependency loop causing build failures on Ubuntu 20.04. Users can pin setuptools_scm < 8.2.0 using PIP_CONSTRAINT or PIP_BUILD_CONSTRAINT in charmcraft.yaml. Upstream fix pending. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as resolved via workarounds. Users pinned setuptools_scm below 8.2.0 using PIP_CONSTRAINT for affected plugins. An upstream dependency cycle was reported, with pip 25.3 introducing PIP_BUILD_CONSTRAINT as a future fix. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#2275
(confidence 100%)
Merged as commit 65d01ed5; added the built-in setuptools-scm build constraint.
-
Caused By:
setuptools-scm#1131
(confidence 98%)
The upstream all-source build dependency cycle triggered the affected Charmcraft builds.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #888 Building with charm version 3.x does not install on bionic (Python >=3.7 is required, 3.6.9 is present) | charmcraft | closed | Closed as not a charmcraft bug: the 22.04-build/18.04-run config was invalid (OS Python 3.6.9 < 3.7), and the bionic build break was an upstream charm-tools 3.x regression fixed in juju/charm-tools#641; broader fix tracked in #878. | |
| #2275 fix(charm): workaround to allow charmcraft-wide constraints | charmcraft | merged | Merged #2275 as commit 65d01ed5, adding a Charmcraft-wide build-constraints workaround for Ubuntu 20.04 failures tracked in #2259 (CHARMCRAFT-614). | |
| #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. | |
| #2615 build(deps): unpin setuptools-scm | charmcraft | merged | Merged in canonical/charmcraft#2615 at e78c495b, removing the temporary setuptools-scm pin after the upstream cyclic-dependency bug was fixed. | |
| #1267 Can't build charm targeted at the current development release: `Skipping 'bases[8].build-on[0]': channel 'devel' does not match host '23.10'.` | charmcraft | closed | Development-release builds stopped being rejected in Charmcraft 3; platform support landed in PR #1554 (commit e3de0a46), and the maintainer closed the report as fixed. | |
| #2302 3.4.6.post107+gda5a7a9a 2025-05-24 (6763) with uv plugin: unable to build against 20.04 | charmcraft | closed | Ubuntu 20.04 build failure with 'no installation candidate' for python3/fuse was transient: maintainer could not reproduce on edge 3.4.6.post113+gb3a1147e (6831); reporter confirmed charmcraft 3.5.3 works. Closed with no code change. |