Visitar URL original
fix: set `UV_PYTHON` for `before_build` on Linux when using `uv` by agriyakhetarpal · Pull Request #2830 · pypa/cibuildwheel · GitHub
Skip to content

fix: set UV_PYTHON for before_build on Linux when using uv - #2830

Merged
agriyakhetarpal merged 3 commits into
pypa:mainfrom
agriyakhetarpal:fix/uv-build-isolation-without-virtual-environment
May 5, 2026
Merged

agriyakhetarpal merged 3 commits into
pypa:mainfrom
agriyakhetarpal:fix/uv-build-isolation-without-virtual-environment

Conversation

@agriyakhetarpal

Copy link
Copy Markdown
Member

Fixes #1955. On Linux, we do not create a virtualenv for the build environment, unlike macOS and Windows which call virtualenv() before before_build runs. This means uv pip install in before_build fails with error: No virtual environment found when using the build[uv] as the build frontend, regardless of whether build isolation is disabled.

We can set UV_SYSTEM_PYTHON=1 to allow uv to install directly into the container's Python. The build-step environment can be left unchanged, so that isolated builds continue to manage their own internal venvs as usual.

I am unsure how to add a test for this, so I haven't added one.

@agriyakhetarpal agriyakhetarpal changed the title Set UV_SYSTEM_PYTHON for before_build on Linux when using uv fix: set UV_SYSTEM_PYTHON for before_build on Linux when using uv May 1, 2026

@henryiii henryiii 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.

I think this makes sense.

@mayeut

mayeut commented May 2, 2026

Copy link
Copy Markdown
Member

I think this makes sense but I'd rather use UV_PYTHON to be 100% explicit.

Co-Authored-By: Matthieu Darbois <mayeut@users.noreply.github.com>
@agriyakhetarpal

Copy link
Copy Markdown
Member Author

Nice, makes sense. Thanks, @mayeut! Addressed via 0d73d51

@henryiii henryiii changed the title fix: set UV_SYSTEM_PYTHON for before_build on Linux when using uv fix: set UV_PYTHON for before_build on Linux when using uv May 4, 2026
@agriyakhetarpal
agriyakhetarpal merged commit a76fca8 into pypa:main May 5, 2026
73 of 74 checks passed
@agriyakhetarpal
agriyakhetarpal deleted the fix/uv-build-isolation-without-virtual-environment branch May 5, 2026 00:09
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.

Installing dependencies before build fails when using uv and disabling build isolation

3 participants