Last modified: Jun 16, 2026

Install uv by Astral in Python

Python developers often look for faster tools. The uv tool by Astral is a modern solution. It manages packages and projects at high speed. This guide shows you how to install uv by Astral in Python. You will learn simple steps. You will see code examples. This article is for beginners.

What is uv by Astral?

uv is a Python package manager. It is written in Rust. This makes it very fast. It can replace pip and pip-tools. Astral created uv. They also made Ruff, a linter. uv handles dependencies well. It works with virtual environments. It is good for both small and large projects.

Why Use uv?

Speed is the main reason. uv installs packages much faster than pip. It also resolves dependencies quickly. uv uses a lockfile. This ensures reproducible builds. You can also use uv to create projects. It is a complete tool for Python workflows.

Another benefit is simplicity. uv has few commands. It is easy to learn. You do not need complex configurations. This makes it great for beginners.

System Requirements

Before you install uv, check your system. uv works on macOS, Linux, and Windows. You need Python 3.8 or later. You also need an internet connection. No other tools are required. uv is self-contained.

How to Install uv by Astral in Python

There are several ways to install uv. The easiest method is using a shell script. Astral provides an official installer. Here are the steps.

Method 1: Using the Official Installer (Recommended)

Open your terminal. Run this command for macOS and Linux:


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

For Windows, use PowerShell:


powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

The installer downloads uv. It places the binary in your PATH. After installation, restart your terminal. Verify the installation with:


uv --version

You will see output like:


uv 0.4.10

This confirms uv is installed. You can now use it.

Method 2: Using pip

You can also install uv via pip. This is useful if you already have Python. Run:


pip install uv

Note: This installs uv as a Python package. It may be slightly slower than the standalone version. But it works well. Check the version with uv --version.

Method 3: Using Homebrew (macOS)

If you use Homebrew, install uv with:


brew install uv

This is another fast option. It keeps uv updated with brew upgrades.

First Steps with uv

After installation, try basic commands. Create a new project:


uv init my_project
cd my_project

This creates a directory with a pyproject.toml file. Add a dependency, like requests:


uv add requests

uv installs the package. It also creates a lockfile. To run Python code, use:


uv run python -c "import requests; print('uv works!')"

Output:


uv works!

You can also use uv to manage virtual environments. Create one with:


uv venv

Activate it with source .venv/bin/activate on Linux or .venv\Scripts\activate on Windows.

Common Installation Issues

Some users face problems. Here are solutions.

Permission errors: On Linux or macOS, you might see permission denied. Use sudo for the installer or install to a user directory. For pip, use pip install --user uv.

PATH not updated: After installation, the uv command may not be found. Restart your terminal. Or add the install directory to your PATH manually.

Windows PowerShell policy: The PowerShell script may be blocked. Run PowerShell as administrator. Then set execution policy with Set-ExecutionPolicy RemoteSigned -Scope CurrentUser.

If you still have trouble, check the official documentation. The Astral team provides support.

Updating uv

Keep uv up to date. Use the built-in update command:


uv self update

This downloads the latest version. For pip installations, use pip install --upgrade uv.

Best Practices

Use uv for all new projects. It is faster and more reliable. Always use a virtual environment. uv creates one automatically with uv init. Commit the lockfile to version control. This ensures consistent environments.

For existing projects, migrate gradually. Replace pip install with uv add. Use uv sync to install dependencies from a lockfile.

Conclusion

Installing uv by Astral in Python is simple. You can use the official installer, pip, or Homebrew. uv speeds up package management. It is beginner-friendly. It works on all major systems. After installation, you can create projects, add packages, and run code. uv is a modern tool for modern Python development. Try it today and see the difference.