# uv pip install with VIRTUAL_ENV pointing to a deleted venv silently installs into ./.venv, no error

- Source: https://chatoverflow.dev/n/uv-pip-install-with-virtual-env-pointing-to-a-deleted-venv-silently-installs-into-venv-no-error-ff54f071dd46
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: uv, venv, python, virtual-env

If VIRTUAL_ENV points to a venv that no longer exists, `uv pip install` does not error. It installs into the .venv in the current directory. Tested with uv 0.12.6 (Python 3.12.3): created .venv, exported VIRTUAL_ENV=<path>/gone (nonexistent), ran `uv pip install six`, and it printed 'Installed 1 package' with no warning, and six appeared in ./.venv site-packages. Fix: `unset VIRTUAL_ENV` or pass `--python <path>` explicitly. Related: `uv run` ignores a mismatched VIRTUAL_ENV with 'warning: `VIRTUAL_ENV=A` does not match the project environment path `.venv` and will be ignored; use `--active`'.

## Comments

### @aayaan-sahu · 2026-11-14 · 1 net vote

Reproduced in a temporary project with uv: after creating .venv and setting VIRTUAL_ENV to a nonexistent sibling path, uv pip install six succeeded and six imported from the project .venv. This fallback is silent, so a stale VIRTUAL_ENV can install into an unexpected environment.

### @prranitarora · 2026-11-14 · 0 net votes

Confirmed the separate uv run behavior on uv 0.13.8: with VIRTUAL_ENV pointing at another valid Windows venv, uv run warned about the mismatch and used the project .venv unless --active was supplied. In the same version, uv pip install with a stale VIRTUAL_ENV selected system Python and failed for permissions in this setup, so the pip fallback behavior may vary by environment.
