Skip to content

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
Install a dependency group pip install --group dev uv sync --group dev
Create a virtual environment python -m venv .venv uv venv (or automatic with uv sync)
Lock dependencies pip lock (experimental, pip 25.1+) or pip-tools uv lock (built in)
Install from a PEP 751 lockfile pip install -r pylock.toml (experimental, pip 26.1+) uv sync
Run a script python script.py (after activating venv) uv run script.py
Run inline-metadata script (PEP 723) pip install --requirements-from-script script.py (pip 26+) uv run script.py
Pin to a past date pip install --uploaded-prior-to 2024-01-01 ... (pip 26+); --uploaded-prior-to P3D (pip 26.1+) exclude-newer = "7 days" in pyproject.toml
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, or pyproject.toml dependency groups pyproject.toml + uv.lock
Cross-platform lockfile No (pip lock targets the current platform only) Yes

Performance

uv is faster than pip at every cache state, but the multiplier depends on what dominates the work. Installing flask, requests, and pandas with both caches emptied took pip 5.4 seconds and uv 0.8 seconds on one Apple Silicon machine, about 7x, because most of that time is spent downloading wheels. Repeating the install with each tool’s cache warm took pip 3.7 seconds and uv 0.04 seconds, closer to 100x, because uv hard-links cached wheels instead of unpacking them again.

Astral’s headline 10-100x spans that spread. Treat the top of the range as a warm-cache figure and the bottom as what a first install on a fresh machine delivers. The uv benchmark table records a larger run with the same shape.

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 requests

uv 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.py

No 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.

pip 25.1 added an experimental pip lock command that writes PEP 751 pylock.toml files, and pip 26.1 added an experimental install side (pip install -r pylock.toml). Both are still single-platform: the generated lockfile is only valid for the Python version and platform that produced it. Sharing a lock across macOS and Linux developers still requires pip-tools or a platform-matrix pipeline.

uv tracks dependencies in pyproject.toml and pins exact versions in uv.lock. Adding or removing a package updates both files automatically. The lockfile is cross-platform by default, and 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 still requires combining it with other tools:

  • venv or virtualenv for environments
  • pip-tools for cross-platform dependency locking (pip’s own pip lock covers a single platform)
  • 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), plus preview commands for formatting, linting, and auditing (uv format, uv check, uv audit).

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. pip 26.0 (January 2026) strengthened that baseline further by adding --requirements-from-script for PEP 723 inline scripts and --uploaded-prior-to for datetime-based package filtering, so several workflows that once required uv now work with pip alone. uv still 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.txt

See How to migrate from requirements.txt to pyproject.toml with uv for the full process including dev dependencies and cleanup.

Related

Last updated on