skip to content

uv β€” Fast Python Package Manager

Install packages and manage virtual environments blazingly fast with uv. Covers uv pip, uv venv, uv run, uv init, and how it compares to pip and poetry.

3 min read 10 snippets yesterday quick read

uv β€” Fast Python Package Manager#

What it is#

uv is a Python package installer and resolver written in Rust by Astral (the same team that makes ruff). It is a drop-in replacement for pip, pip-tools, and virtualenv that runs 10–100Γ— faster. It also supports project-level workflows (uv init, uv add, uv run) as an alternative to poetry.

Install#

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Or via pip (if you already have Python)
pip install uv

Quick example β€” install packages#

uv pip install requests pandas

Output:

Resolved 7 packages in 312ms
Installed 7 packages in 143ms
 + certifi==2024.2.2
 + charset-normalizer==3.3.2
 + idna==3.7
 + numpy==2.0.0
 + pandas==2.2.2
 + python-dateutil==2.9.0
 + requests==2.32.3

When / why to use it#

  • Replacement for pip: faster resolution, better error messages, compatible commands.
  • Replacement for virtualenv + pip-tools: uv venv + uv pip compile replace those two tools.
  • Replacement for poetry (for many use cases): uv init + uv add + uv run give a poetry-like workflow.

[!TIP] If you’re starting a new project from scratch, uv is the recommended tool in 2026. For existing poetry projects, migration is low-effort but optional.

Common pitfalls#

[!WARNING] uv is not pip β€” uv pip install installs into the active virtual environment, not the system Python. If no venv is active, uv installs into an auto-created project venv. Run uv venv first to be explicit.

[!WARNING] uv run is not python β€” uv run script.py uses the project’s venv and can install dependencies on the fly. It is not a direct replacement for python script.py in all contexts.

Virtual environments#

uv venv                     # creates .venv in current directory
uv venv --python 3.12       # specify Python version
source .venv/bin/activate   # activate (Linux/macOS)
.venv\Scripts\activate      # activate (Windows)

Output:

Using CPython 3.12.3
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate

Richer example β€” project workflow#

# Initialize a new project
uv init myapp
cd myapp

# Add dependencies
uv add fastapi "uvicorn[standard]"
uv add --dev pytest ruff mypy

# Run a script
uv run uvicorn main:app --reload

# Sync dependencies from uv.lock
uv sync

# Show what's installed
uv pip list

Output:

Initialized project `myapp` at `/home/user/myapp`

Resolved 18 packages in 1.2s
Installed 18 packages in 380ms
 + annotated-types==0.7.0
 + anyio==4.4.0
 + fastapi==0.111.1
 + uvicorn==0.30.1
 + ...

INFO:     Started server process [12345]
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Drop-in pip commands#

uv pip install <pkg>                  # install
uv pip install -r requirements.txt    # from file
uv pip install -e .                   # editable install
uv pip uninstall <pkg>
uv pip list
uv pip freeze > requirements.txt
uv pip compile requirements.in        # pin transitive deps β†’ requirements.txt

Install Python versions#

uv can download and manage Python interpreters:

uv python install 3.12
uv python install 3.13
uv python list            # show available versions

Output:

Installed Python 3.12.3 in 8.4s
 + cpython-3.12.3-linux-x86_64-gnu

uv vs pip vs poetry#

Featurepippoetryuv
Install speedSlowSlowFast (Rust)
Lockfile❌ (use pip-tools)βœ…βœ… (uv.lock)
Project managementβŒβœ…βœ…
Python version mgmtβŒβŒβœ…
pyproject.toml supportPartialβœ…βœ…
Drop-in for pipβœ…βŒβœ