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

uv executable not found when installed with pipx install nox[uv] #791

Closed
edgarrmondragon opened this issue Mar 4, 2024 · 3 comments · Fixed by #795
Closed

uv executable not found when installed with pipx install nox[uv] #791

edgarrmondragon opened this issue Mar 4, 2024 · 3 comments · Fixed by #795
Labels

Comments

@edgarrmondragon
Copy link
Contributor

Current Behavior

The following exception is raised when a global uv installation is not available.

ValueError: No backends present, looked for ['uv'].

msg = f"No backends present, looked for {backends!r}."

The underlying cause seems to be shutil.which("uv") not being able to find uv installed alongside nox.

"uv": shutil.which("uv") is not None,

Expected Behavior

Installing nox[uv] is sufficient to use uv as a backend, without relying on a global uv installation.

Steps To Reproduce

  1. Install nox[uv]
  2. Configure uv as a venv backend, for example by setting nox.options.default_venv_backend = "uv" in the Noxfile
  3. Run any session

Environment

- OS: macOS
- Python: 3.12
- Nox: 2024.3.2

Anything else?

No response

@edgarrmondragon edgarrmondragon changed the title uv execu uv executable not found when installed with nox[uv] Mar 4, 2024
@cjolowicz
Copy link
Collaborator

pipx doesn't include apps of dependent packages by default. Workaround:

pipx install --include-deps nox[uv]

@cjolowicz
Copy link
Collaborator

cjolowicz commented Mar 4, 2024

Some options:

  1. Document --include-deps
  2. Use python -m uv
  3. Search for uv next to sys.executable if shutil.which returns empty handed

Option 1 puts the burden on the user, and it puts a bunch of unrelated apps on PATH (activate-global-python-argcomplete, python-argcomplete-check-easy-install-script, register-python-argcomplete, virtualenv), producing a warning if any of them already exist.

Option 2 is what we do for virtualenv but incurs unnecessary overhead on startup.

Option 3 is a bit messy but would work out of the box. (Only Windows installations don't have the interpreter next to entry-point scripts, but those would be covered by shutil.which.)

(I guess there's also option 4: Drop the extra in a quick follow-up release? I don't know if there's a five-second rule for backward compatibility.)

Proposal: option 3

@layday
Copy link
Contributor

layday commented Mar 4, 2024

pipx install --include-deps nox[uv] is probably worse than installing nox and uv separately with pipx install nox uv since it'll put a bunch of other, unrelated stuff on $PATH.

@edgarrmondragon edgarrmondragon changed the title uv executable not found when installed with nox[uv] uv executable not found when installed with pipx install nox[uv] Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants