Skip to content

set UV_PYTHON when running maturin develop with uv#3236

Merged
messense merged 1 commit into
PyO3:mainfrom
davidhewitt:develop-uv-python
Jun 20, 2026
Merged

set UV_PYTHON when running maturin develop with uv#3236
messense merged 1 commit into
PyO3:mainfrom
davidhewitt:develop-uv-python

Conversation

@davidhewitt

Copy link
Copy Markdown
Member

If UV_PYTHON is set (e.g. as a default of 3.14 in my .zshrc) and it does not match the current .venv selected, then maturin develop will fail with a version mismatch:

$ uvx maturin develop
🐍 Found CPython 3.11 at /Users/david/Dev/pyo3-scratch/.venv/bin/python
🔗 Found pyo3 bindings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
📦 Built wheel for CPython 3.11 to /var/folders/nt/_zn9g40n6rj9ls6qj3l1g_840000gn/T/.tmpzuneLp/pyo3_scratch-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
💥 maturin failed
  Caused by: uv pip install in /Users/david/Dev/pyo3-scratch/.venv failed running ["pip", "install", "--no-deps", "--force-reinstall", "/var/folders/nt/_zn9g40n6rj9ls6qj3l1g_840000gn/T/.tmpzuneLp/pyo3_scratch-0.1.0-cp311-cp311-macosx_11_0_arm64.whl"]: exit status: 1
--- Stdout:

--- Stderr:
× No solution found when resolving dependencies:
  ╰─▶ Because only pyo3-scratch==0.1.0 is available and pyo3-scratch==0.1.0
      has no wheels with a matching Python version tag (e.g., `cp314`), we can
      conclude that all versions of pyo3-scratch cannot be used.
      And because you require pyo3-scratch, we can conclude that your
      requirements are unsatisfiable.
---

By setting UV_PYTHON to the path of the maturin-resolved python interpreter as part of the install_backend command, this problem goes away.

@messense messense merged commit 0d78921 into PyO3:main Jun 20, 2026
45 checks passed
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.

2 participants