Skip to content

/errors/uv/no-virtual-environment-found

uv: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system`

The commands on this page have not been executed by our verification runner yet.updated
tool
uv
exit code
2
versions
uv 0.5 – 0.12
os
any

error: No virtual environment found; run uv venv to create an environment, or pass --system to install into a non-virtual environment means a uv pip command that changes packages found no environment to change. uv looks for an activated environment (VIRTUAL_ENV), then for .venv in the current folder and its parents. It never installs into the system Python by default. Run uv venv first, or pass --system when the system interpreter is the target on purpose.

Reproduce it

uv pip sync and uv pip install share the same check:

bash
echo "six==1.16.0" > requirements.txt
uv pip sync requirements.txt

uv exits with code 2 for this error, not 1.

Fix

bash
echo "six==1.16.0" > requirements.txt
uv venv -q --python 3.13
uv pip sync requirements.txt      # installs into .venv

Read-only commands such as uv pip list do not fail: without a virtual environment they report the interpreter they found (Using Python 3.x environment at: ...).

SituationUse
Local project with requirements.txtuv venv, then uv pip install -r requirements.txt
Project with pyproject.tomluv add / uv sync (manage .venv for you)
Docker image, install into system Pythonuv pip install --system -r requirements.txt
Environment in another folderuv pip install --python /path/to/venv PACKAGE

Sources