Skip to content

Don't constrain build-system.requires with our dependency-versions - #2583

Merged
henryiii merged 6 commits into
mainfrom
build-constraints
Nov 6, 2025
Merged

Don't constrain build-system.requires with our dependency-versions#2583
henryiii merged 6 commits into
mainfrom
build-constraints

Conversation

@joerick

@joerick joerick commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

Fix #2570.

Don't constrain the versions installed during the package build using dependency-versions. See #2570 for full discussion. AI summary of the change below


This change stops cibuildwheel's dependency-versions from being applied as constraints within the isolated build environment used for the package build. This resolves an issue where conflicts between cibuildwheel's internal requirements and a project's build-system.requires would cause cryptic build failures.

The Problem
Currently, on macOS, Windows, and Pyodide platforms, cibuildwheel injects its own dependency constraints (from CIBW_DEPENDENCY_VERSIONS or the defaults) into the isolated environment where a project's build-time dependencies are installed.

This leads to an issue: if a project specifies a build requirement in pyproject.toml (e.g., conan) that has a dependency conflict with cibuildwheel's constraints (e.g., on urllib3), the build fails with an unhelpful subprocess.CalledProcessError traceback.

This behaviour is also inconsistent, as it does not occur on Linux, which invokes the build without injecting these internal constraints.

The Solution
Remove the logic that sets the PIP_CONSTRAINT and UV_CONSTRAINT environment variables on the build_env before invoking the build frontend (pip wheel or build).

The effect is:

  • The user's project's build-time dependencies are now resolved independently, without interference from cibuildwheel's toolchain constraints.

  • The build process behaviour is now the same across all platforms (Linux, macOS, Windows, and Pyodide)

@agriyakhetarpal agriyakhetarpal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @joerick! While this is a very rare problem to occur, as noted via #2570's reproducer, it鈥檚 good that we are aligning our process with Linux/Docker builds.

@joerick
joerick marked this pull request as draft September 8, 2025 15:31
@joerick

joerick commented Sep 8, 2025

Copy link
Copy Markdown
Contributor Author

The tests are asserting on the version of pip in the build venv, which is reasonable to pin. So I'll try to pin that. But the current structure of the integration test checks the versions in the venv during build of the package, whereas we're more interested in the versions of the tools like virtualenv, or delocate. So I'll think about how we might change that test.

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃憤 Seems reasonable to me from an iOS perspective, and I can't fault the general logic.

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for Pyodide

@joerick
joerick marked this pull request as ready for review September 21, 2025 09:12
@joerick
joerick requested review from henryiii and mayeut September 21, 2025 09:13
@joerick

joerick commented Sep 22, 2025

Copy link
Copy Markdown
Contributor Author

I decided not to pin the version of pip inside the build venv. It was not as easy as setting VIRTUALENV_PIP (this doesn't appear to do anything, fwiw, I think that pip/build uses python -m venv). Instead it would require us to set PIP_CONSTRAINTS again, which is a bit of complexity that I'm not sure we need, and since we don't do it on Linux.

@henryiii
henryiii merged commit 1f2f8b2 into main Nov 6, 2025
35 checks passed
@henryiii
henryiii deleted the build-constraints branch November 6, 2025 22:03
mayeut added a commit to mayeut/cibuildwheel that referenced this pull request Aug 3, 2026
This test is not needed since pypa#2583 and will fail with pip>=26.2
mayeut added a commit to mayeut/cibuildwheel that referenced this pull request Aug 3, 2026
This test is not needed since pypa#2583 and will fail with pip>=26.2
henryiii pushed a commit that referenced this pull request Aug 3, 2026
* fix: test_overridden_pip_constraint with pip>=26.2

* fix(tests): delete test_overridden_pip_constraint

This test is not needed since #2583 and will fail with pip>=26.2
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

Successfully merging this pull request may close these issues.

cibuildwheel fails without diagnostic on dependency conflict

5 participants