LinuxCommandLibrary

uv-pip

Install Python packages

TLDR

Install a package

$ uv pip install [package]
copy

Install packages from a requirements file
$ uv pip install [[-r|--requirements]] [requirements.txt]
copy

Install a package with a specific version
$ uv pip install [package==1.2.3]
copy

Uninstall a package
$ uv pip uninstall [package]
copy

Save installed packages to file
$ uv pip freeze > [requirements.txt]
copy

List installed packages
$ uv pip list
copy

Show information about an installed package
$ uv pip show [package]
copy

Sync environment with a requirements file (install/uninstall to match exactly)
$ uv pip sync [requirements.txt]
copy

SYNOPSIS

uv pip <COMMAND> [OPTIONS] [ARGUMENTS]

PARAMETERS

<COMMAND>
    One of the uv pip subcommands: install, uninstall, list, sync, compile, freeze, etc.

install <PACKAGE>...
    Installs specified Python packages into the current environment.

uninstall <PACKAGE>...
    Uninstalls specified Python packages from the current environment.

list
    Lists installed Python packages in the current environment.

sync
    Synchronizes the environment with a requirements.txt or pyproject.toml, installing missing and removing unneeded packages.

compile <FILE>
    Compiles a lockfile (e.g., requirements.lock) from an input requirements file.

-r, --requirement <FILE>
    Install or synchronize packages listed in the given requirements file.

-e, --editable <PATH>
    Install a project in editable mode (e.g., for local development).

--upgrade
    Upgrade all specified packages to the newest available version.

--force-reinstall
    Reinstall all packages, even if they are already up-to-date.

--target <DIR>
    Install packages into a specific directory, rather than the Python environment's site-packages.

--system
    Use the system Python environment for installation, bypassing virtual environment checks.

--break-system-packages
    Allow installations into system Python, even when discouraged by PEP 668.

--no-deps
    Do not install package dependencies; only install the specified packages themselves.

--dry-run
    Don't actually perform any actions, just show what would be done.

-v, --verbose
    Increase verbosity of output.

-q, --quiet
    Decrease verbosity of output.

DESCRIPTION

uv-pip refers to the uv pip subcommand, which serves as a high-performance, drop-in replacement for Python's traditional pip package manager. Developed by Astral and written in Rust, uv is designed for unparalleled speed, often outperforming pip by orders of magnitude in dependency resolution and package installation.

It aims to provide a unified tool for virtual environment management (like venv) and package installation, streamlining Python project workflows. uv pip supports most common pip commands like install, uninstall, list, and sync, making migration from pip straightforward. Its advanced resolver handles complex dependency graphs efficiently, reducing the likelihood of conflicts and ensuring reproducible builds. This tool is ideal for developers seeking faster build times, more reliable dependency management, and a modern approach to Python environment setup.

CAVEATS

uv-pip is a relatively new and rapidly evolving tool. While aiming for high compatibility with pip, some advanced or obscure pip flags might not be directly supported yet or may have different semantics. It is part of the uv toolkit and works best when uv is also used for virtual environment management (e.g., via uv venv) for a cohesive and optimized workflow. Consider its adoption in production environments with proper testing.

UNMATCHED PERFORMANCE

uv pip leverages the performance characteristics of Rust to deliver significantly faster dependency resolution and package installation compared to pip. This speed advantage is particularly noticeable in complex projects with many dependencies or in CI/CD pipelines, drastically reducing build times and improving developer productivity.

ROBUST DEPENDENCY RESOLUTION

At its core, uv includes a state-of-the-art dependency resolver. This resolver is highly optimized to navigate complex package graphs, identify compatible versions, and resolve conflicts efficiently, leading to more stable and reproducible environments than often achieved with traditional tools.

HISTORY

uv was publicly released by Astral in early 2024, designed to be a modern, high-performance replacement for pip and venv. Written in Rust, its development was driven by the need to address the common performance bottlenecks and complexity issues associated with traditional Python package management tools, particularly in large-scale and continuous integration environments. uv pip emerged as the direct counterpart to pip, aiming to provide a blazingly fast and reliable experience for Python dependency resolution and package installation. Its rapid adoption underscores a significant shift towards more efficient tooling in the Python ecosystem.

SEE ALSO

pip(1), venv(1), uv(1), pip-tools(1)

Copied to clipboard