How to use pip in a uv virtual environment
When working with uv, you might occasionally need access to pip in your virtual environments, particularly when using tools that rely on pip directly, such as Jupyter’s %pip magic command.
Add pip to a uv virtual environment
uv creates virtual environments without pip. If .venv already exists, install pip into it:
uv pip install pipuv pip install targets the .venv in the current directory (or the one named by $VIRTUAL_ENV). The --system flag and UV_SYSTEM_PYTHON=1 bypass that venv and aim at the system interpreter, which is usually externally managed and refuses the install.
For a fresh environment, seed pip at creation time:
uv venv --seeduv venv --seed errors out when a .venv is already there. Add --clear to replace it, which discards everything currently installed.
Keep pip through the next uv sync
In a project with a pyproject.toml and a uv.lock, uv sync removes every package the lockfile does not list. That includes pip and anything pip installed:
$ uv sync
Resolved 5 packages in 1ms
Uninstalled 2 packages in 21ms
- pip==26.2
- six==1.17.0
uv run --exact prunes the same way. Plain uv run does not, so pip survives until the next explicit sync.
To keep pip permanently, let the lockfile own it:
uv add --dev pippip is then a tracked dev dependency, and uv sync reinstalls it instead of deleting it.
Run pip commands
uv run executes inside the environment with no activation step:
uv run pip listTo use bare pip instead, activate the environment first:
source .venv/bin/activate
pip listLearn More
- uv: A Complete Guide covers what uv does, how fast it is, the core workflows, and recent releases.