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.
Adding pip to a uv Virtual Environment
By default, uv virtual environments don’t include pip. To create a virtual environment with pip installed:
uv venv --seed
To add pip to an existing virtual environment:
uv pip install pip
Activating the Environment
Once you’ve created the environment with pip, activate it:
# On Unix/macOS
source .venv/bin/activate
# On Windows
.venv\Scripts\activate
Now you can use pip commands directly, e.g.,
pip list
Last updated on
How to Use `--exclude-newer` for Reproducible Python EnvironmentsHow to write self-contained Python scripts using PEP 723 inline metadata