Open nikhilweee opened 1 week ago
UV_PROJECT_ENVIRONMENT
is only for project-level commands, not the low-level pip
interface. Are you trying to use this in a uv-managed project or an arbitrary directory?
Thanks for the clarification. I'm trying to run this from an arbitrary directory. If this is intended please feel free to close the issue.
In my case it is for an uv-managed project, I find it a little confusing that uv pip
uses .venv
by default without activation, but not UV_PROJECT_ENVIRONMENT
I use uv pip
to work around packages that do not build in isolation, and this example from the doc does not work when UV_PROJECT_ENVIRONMENT
is set:
$ export UV_PROJECT_ENVIRONMENT=/some/other/path/to/venv
$ uv venv
$ uv pip install torch
$ uv sync --no-build-isolation-package=flash-attn
error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment)
Instead one must do:
$ export UV_PROJECT_ENVIRONMENT=/some/other/path/to/venv
$ uv venv
$ VIRTUAL_ENV="${UV_PROJECT_ENVIRONMENT}" uv pip install torch
$ uv sync --no-build-isolation-package=flash-attn
We could consider having uv pip
respect UV_PROJECT_ENVIRONMENT
if you are in a project root, but it's pretty complicated. I think what you're doing is a reasonable workaround. Ideally we'll have better ways to declare build dependencies in the long-run so you don't need to use uv pip
.
Ideally we'll have better ways to declare build dependencies in the long-run so you don't need to use
uv pip
.
I would love that! ❤️
When
UV_PROJECT_ENVIRONMENT
is unset,uv pip install <package>
works without activating venvWhen
UV_PROJECT_ENVIRONMENT
is set,uv pip install <package>
complains about not activating venvThis is with
uv
version0.4.10
Should the behaviour be consistent for both cases? (I think so)