If you're tired of waiting on pip
to resolve and install dependencies, you're going to love uv
. It's a blazing fast, drop-in replacement for pip
that makes traditional installs feel sluggish by comparison.
β‘ The Problem
Python dependency resolution with pip
especially in larger projects can be painfully slow. Dependency backtracking and wheel building often eat up precious minutes in CI pipelines or local dev environments.
π₯ The Solution
Use uv
, a Rust-powered Python package manager by Astral, designed to dramatically accelerate installs and dependency resolution while being compatible with requirements.txt
, pyproject.toml
, and pip
workflows.
π οΈ Quick Setup + Virtual Environment
1. Install uv
curl -Ls https://astral.sh/uv/install.sh | bash
Make sure uv
is in your $PATH
. You can test it with:
uv --version
2. Create a Virtual Environment (with uv
)
Instead of using python -m venv
, you can create a virtual environment directly with uv
:
uv venv .venv
source .venv/bin/activate
β
uv venv
is a faster, more deterministic alternative that supports multiple Python versions if configured.
3. Install Packages
uv pip install -r requirements.txt
#or
uv pip install <package_name>
π§ͺ Benchmark: uv
vs pip
Letβs say weβre installing common ML/development packages from a requirements.txt
:
numpy
pandas
scikit-learn
matplotlib
requests
Installing with pip:
time pip install -r requirements.txt
Result:
real 0m27.123s
user 0m22.854s
sys 0m4.149s
Installing with uv:
time uv pip install -r requirements.txt
Result:
real 0m3.902s
user 0m2.786s
sys 0m1.022s
π‘ Thatβs a 7x speedup β without changing a single line of your dependencies.
β Why Use uv?
- β‘ Fast: Written in Rust, optimized for speed.
- π¦ Compatible: Works with
requirements.txt
,pyproject.toml
, and virtual environments. - π Deterministic: Supports lockfiles and reproducible installs.
- π Drop-in Replacement: No learning curve for
pip
users.
π Final Thoughts
Whether you're spinning up dev environments, deploying ML models, or managing large Python projects, switching to uv
can cut your install times dramatically. Try it onceβyouβll be hooked.