Description
Is the current treatment of CONDA_PREFIX
definitely the right thing to do?
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.
Here's the problem: like many Python users (I imagine), while I don't actually use Conda I did end up with it on my system after one of many frustrating bouts of trying to use one machine learning library or another.
This means most of my shells now have that environment variable set.
As a result, uv
was behaving very strangely for me. I made a bunch of notes in figuring this out here: https://gist.github.com/simonw/975dfa41e9b03bca2513a986d9aa3dcf
TLDR: Running uv pip install -e '.[test]'
installed stuff in my global Conda environment and not my local .venv/
folder and I couldn't figure out why.
I doubt I'm the only person who has been confused by this. Is the current behavior an irreversible decision at this point?