Skip to content

Commit

Permalink
update about uv 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw authored Dec 1, 2024
1 parent 0a6c371 commit ba6ef7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/uv-cli-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,16 @@ Then `uv run pytest` would work without needing to use `--extra` to ensure the t

## There's no need for uv pip

I got into a tangle at first trying to figure this out, because I thought I needed to use `uv pip` to manage my environment... and it turns out `uv pip` follows [these rules](https://docs.astral.sh/uv/pip/environments/#discovery-of-python-environments):
I got into a tangle at first trying to figure this out, because I thought I needed to use `uv pip` to manage my environment... and it turns out `uv pip` followed [these rules](https://docs.astral.sh/uv/pip/environments/#discovery-of-python-environments):

> When running a command that mutates an environment such as `uv pip sync` or `uv pip install`, uv will search for a virtual environment in the following order:
>
> - An activated virtual environment based on the `VIRTUAL_ENV` environment variable.
> - An activated Conda environment based on the `CONDA_PREFIX` environment variable.
> - A virtual environment at `.venv` in the current directory, or in the nearest parent directory.
**Update:** This changed in [uv 0.5.0](https://github.com/astral-sh/uv/releases/tag/0.5.0) so Conda should no longer result in this confusion.

I had Conda installed, which means I had a `CONDA_PREFIX` environment variable set, which meant `uv pip` was ignoring my `.venv` directory entirely and using the Conda environment instead!

This caused all manner of confusion. I [put together this document](https://gist.github.com/simonw/975dfa41e9b03bca2513a986d9aa3dcf) and asked Charlie for help, and he graciously unblocked me.
Expand Down

0 comments on commit ba6ef7b

Please sign in to comment.