Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session.install fails with uv backend if UV_PYTHON is set #948

Open
MikkelSchubert opened this issue Mar 31, 2025 · 1 comment
Open

session.install fails with uv backend if UV_PYTHON is set #948

MikkelSchubert opened this issue Mar 31, 2025 · 1 comment
Labels

Comments

@MikkelSchubert
Copy link

MikkelSchubert commented Mar 31, 2025

Current Behavior

Session.install fails when using uv as the backend, and the UV_PYTHON environment variable is set to a different version of Python than is being used by the current session

Expected Behavior

nox could perhaps filter UV_PYTHON and/or show a warning if it is set

Steps To Reproduce

For the following nox file

import nox

nox.options.default_venv_backend = "uv"

@nox.session(python=["3.11"])
def tests(session):
    session.install("pytest")

Without UV_PYTHON

$ rm -rf .nox __pycache__
$ unset UV_PYTHON
$ nox
nox > Running session tests-3.11
nox > Creating virtual environment (uv) using python3.11 in .nox/tests-3-11
nox > uv pip install pytest
nox > Session tests-3.11 was successful.

With UV_PYTHON

$ rm -rf .nox __pycache__
$ export UV_PYTHON=3.12
$ nox
nox > Running session tests-3.11
nox > Creating virtual environment (uv) using python3.11 in .nox/tests-3-11
nox > uv pip install pytest
nox > Command uv pip install pytest failed with exit code 2:
error: No virtual environment found for Python 3.12; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
nox > Session tests-3.11 failed.

Environment

- OS: Linux Mint 22
- Python: 3.11.11 (managed by uv) and 3.12.3 (system)
- Nox: 2025.2.9
- Uv: 0.6.11

Anything else?

No response

@johnthagen
Copy link
Contributor

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants