Skip to main content

Overview

uv provides a drop-in replacement for common pip, pip-tools, and virtualenv commands. These commands work directly with virtual environments, offering the speed and functionality of uv to power users and projects not ready to transition from pip.
The uv pip interface operates at a lower level than uv’s primary project interface. For new projects, consider using projects instead.
These commands don’t exactly match the tools they’re based on. The further you stray from common workflows, the more likely you are to encounter differences. See the pip compatibility guide for details.
uv doesn’t rely on or invoke pip. The pip interface is named to highlight its purpose: providing low-level commands matching pip’s interface, separate from uv’s higher-level abstractions.

Creating and using environments

Creating virtual environments

Create a virtual environment like python -m venv:
This creates a .venv directory in the current location.

Activating environments

After creating, activate the environment:
See creating environments for more details.

Installing and managing packages

Installing packages

1

Install a single package

2

Install with extras

3

Install multiple packages

4

Install with constraints

Installing from different sources

See Git authentication for private repositories.

Editable packages

Install packages in editable mode:
Changes to source code are immediately active.

Installing from files

Install from various file formats:

Installing dependency groups

Install groups from pyproject.toml:
--group flags don’t apply to other sources like -r. For example, uv pip install -r some/path/pyproject.toml --group foo sources foo from ./pyproject.toml, not some/path/pyproject.toml.

Uninstalling packages

See managing packages for more details.

Locking and syncing environments

Locking requirements

Generate a locked requirements.txt:
By default, uv pip compile prints output to stdout. Use -o / --output-file to write to a file.

Compiling with extras

A --group flag was added to uv pip compile, though pip-tools is considering it. We’ll support whatever syntax they adopt.

Upgrading requirements

uv respects existing pinned versions in output files:
Upgrade specific packages:
Or upgrade everything:

Syncing environments

Sync environment to exactly match a lockfile:
uv pip install keeps existing packages that don’t conflict. uv pip sync removes any packages not in the lockfile, ensuring exact reproducibility.
See locking environments for more details.

Inspecting environments and packages

List installed packages

Check package information

See inspecting environments for more details.

Working with constraints and overrides

Adding constraints

Constraint files control versions without triggering installation:
constraints.txt
uv also reads constraint-dependencies from workspace root pyproject.toml.

Build constraints

Constrain build-time dependencies:
build-constraints.txt
pyproject.toml
Applies to all build-time dependencies in the workspace.

Overriding versions

Force specific versions regardless of declared requirements:
overrides.txt
Overrides replace constituent package requirements completely. Use when transitive dependencies have incorrect bounds, but be aware this may cause runtime errors if the override is incorrect.

Migrating from pip

Common command mappings

Migrating from pip-tools

Complete migration workflow

1

Create environment

2

Activate environment

3

Compile requirements

4

Install packages

5

Sync environment

Universal resolution

Unlike pip and pip-tools, uv can compile requirements for multiple platforms at once:
This creates a single requirements.txt that works across platforms:
requirements.txt
No need for separate requirements files per platform! See universal resolution for details.

Best practices

uv pip sync ensures exact environment matches:
Unlike pip install -r, this removes extraneous packages.
Use --universal for cross-platform projects:
Use multiple requirements files:
requirements-dev.in
Then compile:
For new work, uv projects provide:
  • Automatic environment management
  • Cross-platform lockfiles by default
  • Simplified dependency management
  • No manual activation needed

Next steps

pip compatibility

Understand differences from pip

Migration guide

Migrate from pip to uv projects

Working with projects

Use uv’s project interface instead

pip interface docs

Full pip interface documentation