Skip to main content

What is Python UV?

UV is a fast, modern Python package manager written in Rust. It’s designed as a drop-in replacement for pip, pip-tools, and other package managers, offering significantly better performance (10–100x faster than pip) while maintaining compatibility with the Python ecosystem.
Key Features:
  • Run Scripts — execute scripts within project environments
  • Python version management — install and switch between Python versions
  • Speed — 10–100x faster than pip
  • Dependency management — lock files and reproducible environments

Installation

For more installation options, refer to the official documentation.

Standalone installer

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

PyPI

uv is also available on PyPI:
pip install uv

Shell Autocompletion

After installing UV, set up shell autocompletion for a better user experience.
echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc

Tool Management and Verification

Verify the installed version:
uv --version
Update UV to the latest version:
uv self update
# or
pip install --upgrade uv

Modern UV Project Workflow

This workflow uses uv to create and manage a new Python project from scratch.
1
Create a new project directory
2
mkdir my_uv_project
cd my_uv_project
3
Initialize a new UV project
4
The uv init command sets up a new UV project by creating standard metadata files such as pyproject.toml and .python-version.
5
uv init
6
The folder structure will look like this:
7
my_uv_project/
├── .python-version
├── pyproject.toml
├── main.py
└── README.md
8
(Optional) Create a virtual environment
9
The uv venv command creates an isolated virtual environment named .venv within the project directory.
10
uv venv
11
To target a specific Python version (uv will auto-download it if not present):
12
uv venv --python 3.12
13
Install dependencies, lock, and sync
14
Install packages with uv add. This updates pyproject.toml, resolves the dependency graph, and installs packages into the virtual environment.
15
uv add requests ruff
16
To lock and sync the environment:
17
uv lock
uv sync
18
Run scripts or tools
19
Run Python scripts within the project’s virtual environment:
20
uv run python main.py
uv run main.py
21
Run installed tools directly:
22
uv run ruff check .
23
Export dependencies
24
Export to a requirements.txt file:
25
uv export -o requirements.txt
26
Alternatively, compile from pyproject.toml:
27
uv pip compile pyproject.toml -o requirements.txt

Command Equivalency

For developers transitioning from pip and venv to uv:
pipuv
python -m venv .venvuv venv
pip install <package>uv add <package>
pip install -r requirements.txtuv add -r requirements.txt
pip freeze > requirements.txtuv export -o requirements.txt
pip listuv tree
pip uninstall <package>uv remove <package>

Direct installation with uv pip install

uv also supports the traditional pip install interface:
uv pip install <package>
uv pip install -r requirements.txt

Managing Python Versions

uv will detect and use the system Python by default. You can also install and manage multiple Python versions:
# Install the latest Python version
uv python install

# Install a specific Python version
uv python install 3.14

# Reinstall all previously installed Python versions
uv python install --reinstall

# View installed Python versions
uv python list

# Upgrade all installed Python versions
uv python upgrade

# Upgrade a specific Python version
uv python upgrade 3.13
After installation, uv automatically adds the installed Python version to your PATH:
PS C:\Users\karchunt> python3.13
Python 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Build docs developers (and LLMs) love