astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
26.13k stars 763 forks source link

Warn when the active environment differs from one in the working directory #5837

Open zanieb opened 3 months ago

zanieb commented 3 months ago

Encountered this:

❯ uv venv
Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
❯ uv pip install anyio
Audited 1 package in 3ms
❯ ls .venv/lib/python3.12/site-packages
_virtualenv.pth _virtualenv.py

Very confusing! Of course, I had just activated a different virtual environment and forgot about it.

danielhollas commented 3 months ago

+1, I've encountered this many times.

I think this PR is related to this https://github.com/astral-sh/uv/pull/4835

zanieb commented 3 months ago

Yeah, that could help too.