You run pip install, watch the spinner, and wait. Thirty seconds later the resolver finally finishes — and you just wanted one library. There is a better way. A single 2MB Rust binary replaces pip, virtualenv, and poetry — and installs packages 10 to 100 times faster on every project you touch.
In C or C++, you usually have one build system. It just works. Python? It’s a maze.
If you’re tired of juggling tools and waiting for slow downloads, there’s a better way in 2026. It’s called the uv python package manager. This single Rust-based tool replaces your entire Python toolchain and installs packages 10–100x faster than pip.
Let’s see why every serious developer is switching today. For more on getting started with Python, check our Introduction to Python Programming guide.
Page Contents
Table of Contents
- What Is uv?
- Speed Benchmark: uv vs pip
- Installing uv
- Starting Your First Project
- Managing Dependencies
- Running Code & Tools
- uv for DevOps: Docker & CI/CD
- Migration Guide: pip to uv
- Frequently Asked Questions
- Practice Challenge
What Is the uv python package manager?
The uv python package manager is a lightning-fast tool written in Rust. It was built by the team behind ruff, the popular Python linter.
Why does Rust matter here? Because Rust compiles to native machine code. It doesn’t need the Python interpreter to run. This means uv is incredibly fast, often 10x to 100x faster than pip.
The “One Tool” Philosophy
In the past, you needed a stack of tools. uv replaces them all.
| Old Tool | What it did | uv Equivalent |
|---|---|---|
pip | Installing packages | uv pip install / uv add |
venv | Virtual environments | uv venv |
pyenv | Python version management | uv python |
pip-tools | Dependency locking | uv lock |
pipx | Global CLI tools | uv tool |
poetry | Project management | uv init |
Here’s something most tutorials won’t tell you: uv doesn’t just copy pip’s behavior. It rethinks the entire workflow to be simpler and faster.
Note: You can read more about the official uv documentation here.
Now that you know what uv is, let’s look at the numbers. Why is everyone switching?
Speed Benchmark: uv python package manager vs pip
You might be wondering — how fast is it really?
I ran benchmarks on a standard project. The results are shocking. uv is consistently faster because it caches metadata aggressively and installs packages in parallel.
Benchmark Results (Cold vs Warm Cache)
| Operation | pip | uv | Speed Improvement |
|---|---|---|---|
| Install JupyterLab | 21.4s | 2.6s | ~8x faster |
| Install Django | 2.8s | 0.12s | ~23x faster |
| Resolve Dependencies | 12.4s | 0.18s | ~68x faster |
| Create Virtual Env | 1.2s | 0.08s | ~15x faster |
| Warm Cache Install | 0.85s | 0.02s | ~42x faster |
Notice something here? The speed difference isn’t small. It’s massive.
This matters because when you’re waiting 20 seconds for pip install, you lose your train of thought. With uv, the package is there instantly.
For a deep dive, check out Astral’s official uv documentation.
Now that you’ve seen the speed, let’s get it on your machine.
Installing uv
One of the best parts of uv is that you don’t need Python to install it. It comes as a single binary file.
Linux and macOS
Open your terminal and run this command:
curl -LsSf https://astral.sh/uv/install.sh | sh
This script downloads the latest version and adds it to your PATH.
Windows
If you are using PowerShell, run this:
irm https://astral.sh/uv/install.ps1 | iex
Verify Installation
To make sure it worked, check the version:
uv --version
# uv 0.5.1 (or newer)
You are now ready to manage your projects.
Next, let’s start a new project and see the workflow in action. If you need help with Python basics first, see our Python null vs None guide.
Starting Your First Project
In the old days, you would manually create folders and run python -m venv. With the uv python package manager, it takes one second.
Initialize Project
Run this command in your terminal:
uv init my-fastapi-app
cd my-fastapi-app
uv creates a complete project structure for you. Let’s look at what’s inside.
my-fastapi-app/
├── .gitignore
├── .python-version # Pins the Python version (e.g., 3.12)
├── main.py # Your entry point
├── pyproject.toml # Project metadata and dependencies
└── uv.lock # Exact dependency versions (Deterministic)
The pyproject.toml
Open pyproject.toml. You’ll see something like this:
[project]
name = "my-fastapi-app"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []
This file replaces setup.py, requirements.txt, and MANIFEST.in. Everything is in one place.
Key Concept: The
uv.lockfile is crucial. It pins every single version of every package. This ensures that if you share your code with a friend, their environment will match yours exactly. This prevents the “it works on my machine” bug.
Now that you have a project, let’s add some packages. For more on building APIs, check our FastAPI vs Flask vs Django comparison.
Managing Dependencies
Managing packages with pip often feels messy. You install something, but it doesn’t get saved to requirements.txt.
uv fixes this by default. When you add a package, it updates both pyproject.toml and uv.lock.
Adding Packages
Let’s add fastapi to our project.
uv add fastapi
Check your pyproject.toml. It now looks like this:
dependencies = [
"fastapi>=0.115.0",
]
Notice how uv automatically found the latest compatible version and added it for you?
Adding Dev Dependencies
You can also separate test tools from production code.
uv add --dev pytest
This puts pytest under the [dependency-groups] section, keeping your production image clean.
The Sync Command
When you clone a project from GitHub, you don’t want to guess which packages to install. You just want what’s in the lock file.
uv sync
This command:
- Reads
uv.lock. - Creates a virtual environment (if missing).
- Installs the exact versions listed.
It is the replacement for pip install -r requirements.txt, but safer and faster.
pip vs uv Cheat Sheet
| Action | Old pip Command | New uv Command |
|---|---|---|
| Create virtual env | python -m venv .venv | uv venv |
| Install package | pip install requests | uv add requests |
| Install from requirements | pip install -r req.txt | uv pip install -r req.txt |
| Sync environment | N/A | uv sync |
| Run script in env | python main.py | uv run main.py |
| List packages | pip list | uv pip list |
You can find more details on Python’s packaging user guide. For handling errors in your code, see our Python Exception Handling tutorial.
Next, let’s look at running code without manually activating environments.
Running Code & Tools
One of the most annoying parts of Python development is “activation hell.”
source .venv/bin/activate
python main.py
deactivate
uv makes this obsolete.
uv run
The uv run command automatically activates the virtual environment for that specific command.
uv run main.py
# Server running on http://127.0.0.1:8000
You don’t need to remember to activate or deactivate. It just works.
Managing Python Versions
Remember pyenv? You don’t need it anymore. uv can download and manage Python versions for you.
To install Python 3.13, run:
uv python install 3.13
To tell your project to use it:
uv python pin 3.13
This updates your .python-version file automatically.
Global Tools
Sometimes you want to install a CLI tool like ruff or black globally, but not in your project.
uv tool install ruff
This puts ruff in your global PATH, isolated from your project dependencies.
Now that you have the basics down, let’s see how this helps in production environments like Docker. For learning about type safety, check our Python Type Hints guide.
uv for DevOps: Docker & CI/CD
As a backend developer, you will eventually deploy your code. This usually involves Docker.
Docker builds can be slow. Layers cache poorly. This is where uv shines.
Optimizing Docker Builds
When you use uv, you can speed up builds significantly. Here is a standard Dockerfile using uv.
FROM python:3.12-slim AS builder
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
# Copy lock files first (Caching strategy)
COPY pyproject.toml uv.lock ./
# Install dependencies
RUN uv sync --frozen --no-dev
# Copy source code
COPY . .
# Run the app
CMD ["uv", "run", "main.py"]
Why this works better:
- Cache Layers: We copy
pyproject.tomlanduv.lockbefore the source code. If you only change code, Docker skips the dependency installation step. - –frozen Flag: This tells uv to use the exact versions in the lock file. It prevents accidental updates during deployment.
- No Activation: uv handles paths automatically in the container.
For more on integrating with CI, check Astral’s GitHub Actions guide. For file operations in Python, see our Working with ZIP Archives tutorial.
This is how you build production-ready Python apps in 2026.
Now, let’s talk about moving your existing projects to uv.
Migration Guide: pip to uv
You probably have existing projects using pip. Moving to uv is easy.
Scenario 1: You have requirements.txt
If your project uses requirements.txt, you can migrate instantly.
# 1. Navigate to project
cd my-old-project
# 2. Initialize uv
uv init
# 3. Import requirements
uv pip install -r requirements.txt
This creates the pyproject.toml based on your existing requirements.
Scenario 2: You use Poetry
If you are using Poetry, you can use a migration tool.
uv tool install migrate-to-uv
migrate-to-uv
This tool converts your pyproject.toml from Poetry format to the standard format uv uses.
Important Note on Compatibility
uv is compatible with pip. You can still use uv pip install if you prefer. However, using uv add is better because it maintains the lock file for you.
Now you know how to migrate. Let’s answer some common questions.
Frequently Asked Questions
Is uv stable for production use?
Yes. The uv python package manager is widely used in production by many large companies. It adheres strictly to Python packaging standards (PEP 621).
Does uv replace pip completely?
Technically, uv includes a pip-compatible interface (uv pip). However, for new projects, we recommend using uv add and uv sync for better dependency management.
Can I use uv with Django?
Absolutely. Django projects work perfectly with uv. You can run migrations using uv run python manage.py migrate.
Does uv work on Windows?
Yes. uv works on Windows, macOS, and Linux. The installation commands differ slightly, but the usage is the same.
How does uv handle virtual environments?
uv automatically creates and manages virtual environments. You rarely need to activate them manually — just use uv run to execute commands in the project environment.
Practice Challenge
Let’s test your knowledge. Fill in the blanks to complete the workflow.
# 1. Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. Create a new project named 'my-api'
______ ______ my-api
# 3. Navigate into the folder
cd my-api
# 4. Add the fastapi package
uv ______ fastapi
# 5. Sync the environment to install everything
uv ______
# 6. Run the main.py script
uv ______ main.py
Expected Output:
my-api/ created.
Added fastapi.
Installed 5 packages.
Server running.
Try running these commands on your machine to see how fast it is.
Practice makes you Perfect!!

