AI HANDS-ON

Stop Using Pip: Setup Python with UV for 100x Faster Installs

Published on 2026-03-15

If you have spent any time in the Python ecosystem, you are likely familiar with the headaches of package management. Between managing virtual environments (venv), resolving dependencies with pip, locking packages with pip-tools, and handling multiple Python installations via pyenv or conda, the setup workflow is often fragmented, slow, and prone to breaking.

Enter uv by Astral—an ultra-fast Python package and project manager written in Rust. It replaces pip, pip-tools, pipx, poetry, virtualenv, and pyenv in a single tool, executing installs up to 100x faster than traditional setups.

In this guide, we will walk through installing uv on macOS and Windows, initializing your first clean Python project, and mastering modern local development workflows.


Why Choose uv?

Traditional Python package management suffers from sequential downloads, slow wheel compilation, and fragile dependency solvers. uv solves this by introducing:

  • Blazing Speed: Written in Rust, it utilizes aggressive global caching, parallel downloads, and advanced caching algorithms to install dependencies in milliseconds.
  • All-in-One Engine: It manages Python versions, virtual environments, project configurations, tool executing (pipx-equivalent), and dependencies.
  • Zero-Configuration Versioning: uv automatically downloads and sets up the correct Python version (e.g., Python 3.12) required for your project without needing external tools like pyenv.
  • Standardized Configuration: Uses standard pyproject.toml files, ensuring compatibility across modern packaging tools.

1. Installing uv

uv is distributed as a single standalone binary, meaning it doesn't need Python to be pre-installed on your system to work.

Installation on macOS and Linux

You can install uv via a standalone shell script:

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

Alternatively, if you use Homebrew:

brew install astral-sh/uv/uv

Installation on Windows

Open PowerShell and run the following execution command:

irm https://astral.sh/uv/install.ps1 | iex

To verify that uv is installed correctly, run:

uv --version

2. Managing Python Runtimes Automatically

With uv, you no longer need to manually install Python from python.org or manage multiple versions via your system package manager. uv handles Python runtimes dynamically.

  • List available Python versions:
    uv python list
    
  • Install a specific Python version globally:
    uv python install 3.12
    

If a project requires a specific Python version (e.g., requires-python = ">=3.11"), uv will fetch and run it automatically behind the scenes.


3. Creating Your First Python Project

Let's initialize a brand new project and configure its environment using uv's clean project structure.

Step 1: Initialize the Project

Create a new directory and initialize a basic structure:

mkdir my-python-project
cd my-python-project
uv init

This commands creates:

  • pyproject.toml: The standard project metadata and dependency configuration.
  • hello.py: A boilerplate hello world Python script.
  • .python-version: A file pinning the Python version to use for this directory.

Step 2: Adding Dependencies

To add packages (such as requests or fastapi) to your project, use uv add. uv will resolve the dependencies, write them to your pyproject.toml, create an isolated virtual environment at .venv/, and lock the versions in uv.lock:

uv add requests

If you open pyproject.toml, you will see your dependencies configured cleanly:

[project]
name = "my-python-project"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "requests>=2.31.0",
]

Step 3: Syncing the Environment

If you clone an existing project containing a pyproject.toml or uv.lock, you can recreate the exact virtual environment locally with one command:

uv sync

4. Modern Python Workflows

One of uv's biggest advantages is how it streamlines running code.

Running Scripts Without Manual Virtual Environment Activation

Traditionally, you have to run source .venv/bin/activate before executing your Python scripts. With uv, you run:

uv run hello.py

uv run automatically executes your script inside the context of the project's virtual environment, guaranteeing all installed dependencies are in scope.

Running CLI Tools with uvx

If you need to execute a Python CLI tool (like ruff for formatting or black for linting) but don't want to install it permanently in your project, use uvx (the npx equivalent for Python):

uvx ruff format hello.py

uvx downloads the tool into a ephemeral environment, formats the file, and discards the overhead—keeping your global environment completely clean.


Conclusion

By adopting uv, you eliminate the complexity of virtual environments, version conflicts, and slow installers. It sets a clean, modern foundation for your local machine, preparing your environment for complex workflows like full-stack development, automation scripting, and local AI modeling.