What's the difference between pip and uv?
pip and uv both install Python packages from PyPI, but they solve different problems. pip installs packages. uv manages entire Python projects: dependencies, environments, interpreters, and lockfiles.
Side-by-side comparison
| pip | uv | |
|---|---|---|
| Install a package | pip install requests |
uv add requests |
| Install from requirements | pip install -r requirements.txt |
uv add -r requirements.txt |
| Create a virtual environment | python -m venv .venv |
uv venv (or automatic with uv sync) |
| Lock dependencies | Requires pip-tools | uv lock (built in) |
| Run a script | python script.py (after activating venv) |
uv run script.py |
| Install Python itself | Requires pyenv or system package | uv python install 3.12 |
| Run CLI tools | Requires pipx | uvx ruff check . |
| Dependency file | requirements.txt | pyproject.toml + uv.lock |
| Cross-platform lockfile | No | Yes |
Performance
uv resolves and installs dependencies 10-100x faster than pip. The gap comes from parallel downloads, aggressive caching of metadata and artifacts, and a resolver written in a compiled language. Cold installs that take minutes with pip often finish in seconds with uv.
Environment management
pip operates on whatever Python environment is active. Creating and activating a virtual environment requires separate tools (venv or virtualenv):
python -m venv .venv
source .venv/bin/activate # macOS/Linux
pip install requestsuv creates and manages virtual environments automatically. uv run ensures the environment exists and matches the lockfile before executing a command:
uv add requests
uv run python app.pyNo activation step, no risk of installing into the wrong environment.
Dependency tracking
pip installs packages but does not record which were explicitly requested. Keeping a requirements.txt in sync with the environment is a manual process, and the file contains no distinction between direct and transitive dependencies.
uv tracks dependencies in pyproject.toml and pins exact versions in uv.lock. Adding or removing a package updates both files automatically. The virtual environment becomes disposable because uv sync can rebuild it from the lockfile at any time.
Scope
pip focuses on package installation. Building a complete workflow requires combining it with other tools:
- venv or virtualenv for environments
- pip-tools for dependency locking
- pyenv for Python version management
- pipx for isolated CLI tools
uv replaces all of these with a single binary. It handles Python version management, virtual environments, dependency locking, CLI tool execution (uvx), project scaffolding (uv init), and package publishing (uv publish).
When pip is the right choice
pip ships with Python and requires no extra installation. It remains a reasonable default for quick experiments, CI images that already have it pre-installed, or projects locked into a requirements.txt workflow. uv also provides a pip-compatible interface (uv pip install) that drops into existing pip-based workflows with no structural changes, giving an immediate speed boost.
Switching from pip to uv
For existing projects with a requirements.txt, migration takes a few commands:
uv init --bare
uv add -r requirements.txtSee How to migrate from requirements.txt to pyproject.toml with uv for the full process including dev dependencies and cleanup.
Related
- uv reference documents all uv commands
- pip reference covers pip’s capabilities
- Why use native uv commands instead of uv pip compares uv’s two interfaces
- Why choose pyproject.toml over requirements.txt? explains the benefits of declarative dependency management
- How to install uv covers installation on all platforms
- Create your first Python project walks through starting a new uv project