How to Install uv on Ubuntu 26.04, 24.04 and 22.04

Install uv on Ubuntu 26.04, 24.04, or 22.04 with Astral's installer, pipx, Homebrew, or Snap. Covers PATH checks and removal.

PublishedAuthorJoshua JamesRead time9 minGuide typeUbuntu

Python packaging on Ubuntu can get messy when project environments, command-line tools, lock files, and system Python all compete for the same shell. To install uv on Ubuntu Linux cleanly, choose an install method that matches how you want updates and PATH ownership to work: Astral’s standalone installer for most users, PyPI through pipx for isolated Python CLI management, or a package-manager path such as Homebrew or Snap when that manager already owns your developer tools.

Ubuntu 26.04, 24.04, and 22.04 do not provide a usable APT package named uv from the default repositories, so sudo apt install uv is not the install path. APT is still useful for prerequisites such as curl, pipx, and python3-venv, while uv itself comes from Astral’s release installer, PyPI, Homebrew, or the Snap Store.

Install uv on Ubuntu

Astral’s official uv installation documentation lists the standalone installer, PyPI, Homebrew, and other package sources. On Ubuntu, the standalone installer is the best default because it installs the current upstream release without changing Ubuntu’s system Python or adding an APT repository.

Choose a uv Installation Method

Use one method for your normal shell unless you deliberately want multiple copies for testing. Several methods install commands named uv and uvx, and your shell runs whichever one appears first on PATH.

MethodSource or ChannelUpdate BehaviorBest ForTrade-offs
Standalone installerAstral install scriptuv self updateMost Ubuntu users who want the current upstream binaryUser-scoped install under ~/.local/bin; no APT ownership
PyPI with pipxPyPI packagepipx upgrade uvUsers who already manage Python CLI tools with pipxDepends on pipx and user PATH setup; still outside APT updates
PyPI with pip in venvPyPI packagepython -m pip install --upgrade uvTemporary test environments, CI jobs, or venv-scoped usageNot a system-wide CLI; the command belongs to that virtual environment
HomebrewHomebrew core formulabrew upgrade uvUbuntu workstations already using LinuxbrewUses the Homebrew prefix and update model, not APT
SnapSnap package astral-uvsudo snap refresh astral-uvUsers who prefer Snap-managed CLI packagesClassic confinement; stable channel can lag behind the current upstream release

Use the standalone installer when you want Astral’s current Linux binary and uv’s own updater. Use pipx when your workstation already treats Python applications as isolated pipx tools. Use Homebrew or Snap only when those package managers are already part of your Ubuntu workflow, because they own their own channels, update timing, and removal behavior.

Prepare Ubuntu for uv Installation

Refresh APT metadata and install HTTPS certificate support plus the curl command. Minimal Ubuntu systems often omit curl, and the standalone installer needs it for the documented one-line install command.

sudo apt update
sudo apt install curl ca-certificates

These commands use sudo for package installation. If your user cannot run administrative commands yet, configure access with the guide to add a user to sudoers on Ubuntu before installing uv.

Inspect the uv Install Script Before Running It

The standalone method pipes a remote shell script into sh. Inspect the script first when you want to see exactly what it will do before execution.

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

Press q to exit less. The current installer downloads uv release archives from Astral’s release mirror or GitHub, installs uv and uvx into a user executable directory, and can add that directory to your shell startup files. It does not add an Ubuntu APT repository.

The -LsSf flags make curl follow redirects, keep normal progress quiet, show errors when they occur, and fail on HTTP error responses instead of piping an error page into the next command.

Check for Existing uv Commands

Check whether another method already provides uv or uvx before running the standalone installer. The installer writes new command files into its target user bin directory, so move any manually managed copy you need to keep before continuing.

command -v uv || true
command -v uvx || true
ls -l "$HOME/.local/bin/uv" "$HOME/.local/bin/uvx" 2>/dev/null || true

No output from the ls line means the default standalone target does not already contain those command files. If command -v points to Homebrew, Snap, pipx, or another path, decide whether you want the standalone copy to take precedence before installing.

Install uv with the Standalone Installer

Run Astral’s installer after you are comfortable with the script contents.

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

Relevant output includes the release, target architecture, install directory, and installed command names. The version number changes as Astral publishes new releases.

downloading uv 0.11.16 x86_64-unknown-linux-gnu
installing to /home/username/.local/bin
  uv
  uvx
everything's installed!

The installer normally creates ~/.local/bin/env and asks you to reload it for the current shell. A new terminal also picks up the PATH change after your shell startup files run.

source "$HOME/.local/bin/env"
hash -r

Install uv from PyPI with pipx

The PyPI method works best through pipx, because pipx creates an isolated environment for the uv application and exposes the uv and uvx commands through your user-local bin directory.

sudo apt install pipx
pipx ensurepath
export PATH="$HOME/.local/bin:$PATH"
pipx install uv

The pipx package comes from Ubuntu’s Universe component. If APT cannot locate it on a customized installation, enable Universe with the Ubuntu Universe and Multiverse guide, then repeat the install command.

Successful pipx output lists both commands. Example output from Ubuntu 26.04 begins like this:

installed package uv 0.11.16, installed using Python 3.14.4
These apps are now globally available
  - uv
  - uvx

Install uv from PyPI Inside a Virtual Environment

Use plain pip install uv only inside an environment you intentionally manage. On Ubuntu, installing Python applications into the system interpreter can trigger externally managed environment protection or overwrite paths APT expects to control.

sudo apt install python3-venv
mkdir -p ~/venvs
python3 -m venv ~/venvs/uv-test
source ~/venvs/uv-test/bin/activate
python -m pip install --upgrade pip
python -m pip install uv
uv --version

This method keeps uv inside ~/venvs/uv-test. Deactivate the environment when you no longer need that venv-scoped command.

deactivate

For regular project dependencies, use a project virtual environment instead of treating this venv as a global tool prefix. The separate Python virtual environment guide for Ubuntu covers isolation, while the Python pip guide for Ubuntu covers broader pip package-management behavior.

Install uv with Homebrew on Ubuntu

Homebrew publishes uv in its core formula set. Use this method only when Homebrew is already installed on Ubuntu or you deliberately want Homebrew to own uv updates.

brew update
brew install uv

Homebrew installs uv under the Homebrew prefix, commonly /home/linuxbrew/.linuxbrew/bin/uv on Linux. If another uv install already exists, check PATH order before assuming Homebrew’s copy is the one running.

Install uv with Snap on Ubuntu

Snapcraft publishes uv as astral-uv. The Snap package uses classic confinement and may not track the newest upstream release as quickly as the standalone installer, PyPI, or Homebrew formula.

snap info astral-uv

Install the stable Snap channel when you prefer Snap-managed updates.

sudo snap install astral-uv --classic

If the Snap candidate channel has the release you need, install or switch to that channel deliberately.

sudo snap install astral-uv --classic --channel=latest/candidate

For an existing Snap install, switch channels with refresh instead.

sudo snap refresh astral-uv --channel=latest/candidate

Verify uv on Ubuntu

Check both installed commands. uv is the main project and package-management command, while uvx runs tools in isolated temporary environments.

uv --version
uvx --version

Current standalone and PyPI installs return output like this, while Snap stable can show an older version until its stable channel refreshes.

uv 0.11.16 (x86_64-unknown-linux-gnu)
uvx 0.11.16 (x86_64-unknown-linux-gnu)

Confirm which copy your shell will run. This is especially useful after testing more than one method.

command -v uv
command -v uvx
Active Path PatternLikely MethodWhat It Means
/home/username/.local/bin/uvStandalone installer or pipxUser-local tools come before system package paths.
/home/linuxbrew/.linuxbrew/bin/uvHomebrewHomebrew owns updates and removal.
/snap/bin/uvSnapSnap owns channel selection, refreshes, and removal.
/home/username/venvs/uv-test/bin/uvpip inside a venvThe command works only while that environment is active.

Get Started with uv on Ubuntu

A good uv first run should prove more than the version command. The workflow creates a small project, lets uv build a project-local virtual environment, adds a dependency, and uses uvx for a one-off tool run without installing that tool globally.

Create a New uv Project

Create a projects directory with mkdir, initialize a new uv project, and run the generated Python file.

mkdir -p ~/projects
cd ~/projects
uv init lc-uv-demo
cd lc-uv-demo
uv run main.py

On a fresh project, uv creates .venv automatically before running the file. The Python branch follows your Ubuntu release unless the project requests another interpreter. Example output from Ubuntu 26.04 begins like this:

Initialized project `lc-uv-demo` at `/home/username/projects/lc-uv-demo`
Using CPython 3.14.4 interpreter at: /usr/bin/python3.14
Creating virtual environment at: .venv
Hello from lc-uv-demo!

Add a Dependency with uv

Add the requests package to the project. uv resolves dependencies, updates the project files, and installs packages into the project virtual environment.

uv add requests

Confirm that the dependency imports from the uv-managed environment.

uv run python -c "import requests; print(requests.__version__)"

The printed version follows the current package release resolved for your project. The important part is that uv run uses the project environment instead of installing the package into Ubuntu’s system Python.

Run a One-Off Tool with uvx

Use uvx when you want to run a Python command-line tool without keeping it installed as a global command. This example downloads and runs Ruff in an isolated tool environment, then prints the Ruff version.

uvx ruff --version
Downloading ruff (10.9MiB)
 Downloaded ruff
Installed 1 package in 5ms
ruff 0.15.14

Use uv tool install instead when you want a Python CLI to stay available as a normal command between shell sessions.

uv tool install ruff

If uv warns that the tool executable directory is not on PATH yet, add your user-local bin directory for the current shell and retry the version check.

export PATH="$HOME/.local/bin:$PATH"

Verify the persistent command after uv finishes installing it.

ruff --version

Remove a uv-managed tool when you no longer need the persistent command.

uv tool uninstall ruff

Update uv on Ubuntu

Update uv with the same method that installed it. Do not use uv self update for a Snap, Homebrew, pipx, or venv install because those package managers own the installed files.

Update a Standalone uv Install

Standalone installs include uv’s self-updater.

uv self update

If the installed binary is already current, uv reports that no update is needed.

info: Checking for updates...
success: You're already on version v0.11.16 of uv (the latest version).

Update a pipx uv Install

Use pipx for PyPI installs created with pipx install uv.

pipx upgrade uv
uv --version

Update a venv pip uv Install

Activate the same virtual environment before upgrading a venv-scoped uv install.

source ~/venvs/uv-test/bin/activate
python -m pip install --upgrade uv
uv --version

Update a Homebrew uv Install

Homebrew updates uv through its formula metadata and bottle downloads.

brew update
brew upgrade uv
uv --version

Update a Snap uv Install

Snap refreshes the installed channel automatically, but you can request a refresh manually.

sudo snap refresh astral-uv
uv --version

If you deliberately installed the candidate channel, keep the refresh aligned with that channel.

sudo snap refresh astral-uv --channel=latest/candidate

Troubleshoot uv on Ubuntu

Most uv installation issues on Ubuntu come from PATH ordering, using pip against the system interpreter, or expecting the Snap stable channel to match Astral’s current release immediately.

Fix uv Command Not Found

If uv is installed but your shell cannot find it, check the expected path for your method before reinstalling.

command -v uv || true
ls -l "$HOME/.local/bin/uv" "$HOME/.local/bin/uvx" 2>/dev/null || true
ls -l /snap/bin/uv 2>/dev/null || true
ls -l /home/linuxbrew/.linuxbrew/bin/uv 2>/dev/null || true

For standalone installs, reload the env script created by the installer.

source "$HOME/.local/bin/env"
hash -r
uv --version

For pipx installs, make sure ~/.local/bin is visible in the current shell.

pipx ensurepath
export PATH="$HOME/.local/bin:$PATH"
uv --version

For Snap installs, check whether /snap/bin is visible in the current shell. A new login session normally loads Snap’s profile scripts, but you can refresh the current terminal temporarily and retest.

printf '%s\n' "$PATH" | tr ':' '\n' | grep -Fx /snap/bin || true
export PATH="/snap/bin:$PATH"
uv --version

If PATH is still the only problem, Snap can run the packaged command directly through the app alias.

snap run astral-uv.uv --version
snap run astral-uv.uvx --version

Fix APT Unable to Locate Package uv

APT cannot install uv from the default Ubuntu repositories when no exact uv package is available. Use the standalone installer, PyPI through pipx, Homebrew, or Snap instead.

apt-cache search --names-only '^uv$'
apt-cache madison uv

No output from both commands means APT has no exact package named uv from your enabled Ubuntu sources.

Fix externally-managed-environment from pip

The externally-managed-environment error means pip is trying to install into Ubuntu’s managed system Python. Do not solve this by adding sudo or forcing --break-system-packages for uv.

error: externally-managed-environment
This environment is externally managed.

Use pipx for a persistent user command.

sudo apt install pipx
pipx ensurepath
export PATH="$HOME/.local/bin:$PATH"
pipx install uv

Use a virtual environment when you only need uv inside one disposable Python environment.

mkdir -p ~/venvs
python3 -m venv ~/venvs/uv-test
source ~/venvs/uv-test/bin/activate
python -m pip install uv

Check Snap Stable and Candidate Versions

If Snap installs an older uv release than the official documentation or PyPI, inspect the channel map first. Snap stable and candidate channels can differ.

snap info astral-uv

If the candidate channel has the version you need, switch deliberately. Otherwise, use the standalone installer or pipx for the current upstream release without changing Snap channels.

sudo snap refresh astral-uv --channel=latest/candidate
uv --version

Remove uv from Ubuntu

Remove uv with the same method that installed it. Clean package files first, then decide separately whether to delete uv-managed caches, downloaded Python versions, tools, and project environments.

Remove a Standalone uv Install

Clean uv’s cache before removing the binary if you want to reclaim package cache space.

uv cache clean

Print uv-managed Python and tool directories before deciding whether to delete them.

uv python dir
uv tool dir

This cleanup command permanently deletes Python versions and tools managed by uv for your user account. Back up or skip any managed runtime or tool you still need.

rm -rf "$(uv python dir)" "$(uv tool dir)"

Remove the standalone command files and the installer receipt, clear the current shell’s command cache, and verify that the command is gone. Keep other files under ~/.config/uv if you use uv configuration for projects or tools.

rm -f "$HOME/.local/bin/uv" "$HOME/.local/bin/uvx" "$HOME/.config/uv/uv-receipt.json"
hash -r
command -v uv || echo "uv removed"
uv removed

If command -v uv still prints another path, a different install method is still active. Use the matching removal section for that method or adjust PATH order instead of deleting unrelated command files.

Leave ~/.local/bin/env, ~/.local/bin/env.fish, and the shell line that sources them in place when other user-local tools need ~/.local/bin on PATH. Remove those startup lines only when uv was the only reason you added that user-local bin directory.

Remove a pipx uv Install

pipx removes the isolated uv environment and command shims it created.

pipx uninstall uv
hash -r
command -v uv || echo "uv removed"

Remove a venv pip uv Install

For a venv-scoped install, uninstall the package while the environment is active.

source ~/venvs/uv-test/bin/activate
python -m pip uninstall uv
deactivate

Deleting the virtual environment removes every package installed inside it. Run this only for a disposable uv test environment, not a project environment that still contains dependencies you need.

rm -rf ~/venvs/uv-test

Remove a Homebrew uv Install

Use Homebrew for installs created with brew install uv.

brew uninstall uv
hash -r
command -v uv || echo "uv removed"

Remove a Snap uv Install

Remove the Snap package with --purge when you do not want Snap to keep a recovery snapshot for the app.

sudo snap remove --purge astral-uv
snap list astral-uv 2>/dev/null || echo "astral-uv not installed"
astral-uv not installed

Conclusion

uv is ready on Ubuntu when uv --version, uvx --version, and a small uv init project all work from the shell you plan to use. Keep the standalone installer or pipx path for the freshest upstream releases, and use Homebrew or Snap only when those managers already fit your update and removal workflow.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: