2024-06-26 12:28:42 -04:00
# Installing uv
2024-08-22 18:04:34 -05:00
## Installation methods
2024-06-26 12:28:42 -04:00
2024-08-22 18:04:34 -05:00
Install uv with our standalone installers or your package manager of choice.
### Standalone installer
2024-06-26 12:28:42 -04:00
2024-08-05 09:54:06 -04:00
uv provides a standalone installer to download and install uv:
2024-06-26 12:28:42 -04:00
2024-08-27 13:05:14 +02:00
=== "macOS and Linux"
2024-06-26 12:28:42 -04:00
2024-11-13 09:51:30 -08:00
Use `curl` to download the script and execute it with `sh` :
2024-08-27 13:05:14 +02:00
```console
$ curl -LsSf https://astral.sh/uv/install.sh | sh
` ``
2024-11-13 09:51:30 -08:00
If your system doesn't have ` curl`, you can use ` wget`:
2024-08-27 13:05:14 +02:00
` ``console
2024-11-13 09:51:30 -08:00
$ wget -qO- https://astral.sh/uv/install.sh | sh
2024-08-27 13:05:14 +02:00
` ``
2024-06-26 12:28:42 -04:00
2024-11-13 09:51:30 -08:00
Request a specific version by including it in the URL:
2024-09-07 10:26:37 -05:00
` ``console
2025-03-06 14:39:23 -06:00
$ curl -LsSf https://astral.sh/uv/0.6.5/install.sh | sh
2024-09-07 10:26:37 -05:00
` ``
=== "Windows"
2024-11-13 09:51:30 -08:00
Use ` irm` to download the script and execute it with ` iex`:
` ``console
$ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
` ``
Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4#powershell-execution-policies) allows running a script from the internet.
Request a specific version by including it in the URL:
2024-09-07 10:26:37 -05:00
` ``console
2025-03-06 14:39:23 -06:00
$ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.6.5/install.ps1 | iex"
2024-09-07 10:26:37 -05:00
` ``
2024-06-26 12:28:42 -04:00
2024-07-24 18:10:33 -04:00
!!! tip
2024-07-17 10:29:16 -04:00
2024-08-03 08:41:33 -05:00
The installation script may be inspected before use:
2024-07-17 10:29:16 -04:00
2024-08-27 13:05:14 +02:00
=== "macOS and Linux"
2024-07-19 22:28:46 +08:00
2024-08-27 13:05:14 +02:00
` ``console
$ curl -LsSf https://astral.sh/uv/install.sh | less
` ``
=== "Windows"
` ``console
$ powershell -c "irm https://astral.sh/uv/install.ps1 | more"
` ``
2024-07-17 10:29:16 -04:00
Alternatively, the installer or binaries can be downloaded directly from [GitHub](#github-releases).
2024-10-24 16:04:21 -05:00
See the documentation on [installer configuration](../configuration/installer.md) for details on
customizing your uv installation.
2024-09-17 09:09:30 -07:00
2024-08-22 18:04:34 -05:00
### PyPI
2024-06-26 12:28:42 -04:00
2024-07-17 10:29:02 -04:00
For convenience, uv is published to [PyPI](https://pypi.org/project/uv/).
2024-06-26 12:28:42 -04:00
2024-07-22 13:15:11 -04:00
If installing from PyPI, we recommend installing uv into an isolated environment, e.g., with ` pipx`:
2024-06-26 12:28:42 -04:00
2024-08-03 08:41:33 -05:00
` ``console
$ pipx install uv
2024-06-26 12:28:42 -04:00
` ``
However, ` pip` can also be used:
2024-08-03 08:41:33 -05:00
` ``console
$ pip install uv
2024-06-26 12:28:42 -04:00
` ``
2024-07-22 13:15:11 -04:00
!!! note
2024-08-05 09:54:06 -04:00
uv ships with prebuilt distributions (wheels) for many platforms; if a wheel is not available for a given
platform, uv will be built from source, which requires a Rust toolchain. See the
2024-07-30 18:17:58 -04:00
[contributing setup guide](https://github.com/astral-sh/uv/blob/main/CONTRIBUTING.md#setup)
for details on building uv from source.
2024-07-17 10:29:02 -04:00
2024-09-03 19:24:55 -05:00
### Cargo
uv is available via Cargo, but must be built from Git rather than [crates.io](https://crates.io) due
to its dependency on unpublished crates.
` ``console
$ cargo install --git https://github.com/astral-sh/uv uv
` ``
2024-08-22 18:04:34 -05:00
### Homebrew
2024-06-26 12:28:42 -04:00
uv is available in the core Homebrew packages.
2024-08-03 08:41:33 -05:00
` ``console
$ brew install uv
2024-06-26 12:28:42 -04:00
` ``
2025-01-06 20:18:01 +01:00
### WinGet
2024-09-05 11:32:57 -05:00
2025-01-06 20:18:01 +01:00
uv is available via [WinGet](https://winstall.app/apps/astral-sh.uv).
2024-09-05 11:32:57 -05:00
` ``console
$ winget install --id=astral-sh.uv -e
` ``
2025-01-06 20:18:01 +01:00
### Scoop
uv is available via [Scoop](https://scoop.sh/#/apps?q=uv).
` ``console
$ scoop install main/uv
` ``
2024-08-22 18:04:34 -05:00
### Docker
2024-06-26 12:28:42 -04:00
2024-07-30 18:17:58 -04:00
uv provides a Docker image at
[` ghcr.io/astral-sh/uv`](https://github.com/astral-sh/uv/pkgs/container/uv).
2024-06-26 12:28:42 -04:00
2024-08-09 12:31:10 -05:00
See our guide on [using uv in Docker](../guides/integration/docker.md) for more details.
2024-07-17 10:29:16 -04:00
2024-08-22 18:04:34 -05:00
### GitHub Releases
2024-07-17 10:29:16 -04:00
2024-08-02 15:58:31 +02:00
uv release artifacts can be downloaded directly from
[GitHub Releases](https://github.com/astral-sh/uv/releases).
2024-07-17 10:29:16 -04:00
2024-07-30 18:17:58 -04:00
Each release page includes binaries for all supported platforms as well as instructions for using
the standalone installer via ` github.com` instead of ` astral.sh`.
2024-08-06 13:48:04 -05:00
2024-08-22 18:04:34 -05:00
## Upgrading uv
When uv is installed via the standalone installer, it can update itself on-demand:
` ``console
$ uv self update
` ``
2024-09-05 11:15:39 -05:00
!!! tip
Updating uv will re-run the installer and can modify your shell profiles. To disable this
behavior, set ` INSTALLER_NO_MODIFY_PATH=1`.
2024-08-22 18:04:34 -05:00
When another installation method is used, self-updates are disabled. Use the package manager's
upgrade method instead. For example, with ` pip`:
` ``console
$ pip install --upgrade uv
` ``
## Shell autocompletion
2025-02-05 18:33:48 -05:00
!!! tip
You can run ` echo $SHELL` to help you determine your shell.
2024-08-22 18:04:34 -05:00
To enable shell autocompletion for uv commands, run one of the following:
2025-02-05 18:33:48 -05:00
=== "Bash"
2024-08-22 18:04:34 -05:00
` ``bash
echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc
2025-02-05 18:33:48 -05:00
` ``
=== "Zsh"
` ``bash
2024-08-22 18:04:34 -05:00
echo 'eval "$(uv generate-shell-completion zsh)"' >> ~/.zshrc
2025-02-05 18:33:48 -05:00
` ``
=== "fish"
` ``bash
2024-08-22 18:04:34 -05:00
echo 'uv generate-shell-completion fish | source' >> ~/.config/fish/config.fish
2025-02-05 18:33:48 -05:00
` ``
=== "Elvish"
` ``bash
2024-08-22 18:04:34 -05:00
echo 'eval (uv generate-shell-completion elvish | slurp)' >> ~/.elvish/rc.elv
` ``
2025-02-05 18:33:48 -05:00
=== "PowerShell / pwsh"
2024-08-22 18:04:34 -05:00
` ``powershell
2025-02-05 18:33:48 -05:00
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
2024-08-23 12:22:50 +08:00
Add-Content -Path $PROFILE -Value '(& uv generate-shell-completion powershell) | Out-String | Invoke-Expression'
2024-08-22 18:04:34 -05:00
` ``
2024-09-20 03:27:25 +02:00
To enable shell autocompletion for uvx, run one of the following:
2025-02-05 18:33:48 -05:00
=== "Bash"
2024-09-20 03:27:25 +02:00
` ``bash
echo 'eval "$(uvx --generate-shell-completion bash)"' >> ~/.bashrc
2025-02-05 18:33:48 -05:00
` ``
=== "Zsh"
` ``bash
2024-09-20 03:27:25 +02:00
echo 'eval "$(uvx --generate-shell-completion zsh)"' >> ~/.zshrc
2025-02-05 18:33:48 -05:00
` ``
=== "fish"
` ``bash
2024-09-20 03:27:25 +02:00
echo 'uvx --generate-shell-completion fish | source' >> ~/.config/fish/config.fish
2025-02-05 18:33:48 -05:00
` ``
=== "Elvish"
` ``bash
2024-09-20 03:27:25 +02:00
echo 'eval (uvx --generate-shell-completion elvish | slurp)' >> ~/.elvish/rc.elv
` ``
2025-02-05 18:33:48 -05:00
=== "PowerShell / pwsh"
2024-09-20 03:27:25 +02:00
` ``powershell
2025-02-05 18:33:48 -05:00
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
2024-09-20 03:27:25 +02:00
Add-Content -Path $PROFILE -Value '(& uvx --generate-shell-completion powershell) | Out-String | Invoke-Expression'
` ``
2024-08-22 18:04:34 -05:00
Then restart the shell or source the shell config file.
## Uninstallation
2024-12-16 18:56:05 +00:00
If you need to remove uv from your system, follow these steps:
2024-08-22 18:04:34 -05:00
2024-12-16 18:56:05 +00:00
1. Clean up stored data (optional):
2024-10-06 11:29:17 -03:00
` ``console
2024-12-16 18:56:05 +00:00
$ uv cache clean
$ rm -r "$(uv python dir)"
$ rm -r "$(uv tool dir)"
2024-10-06 11:29:17 -03:00
` ``
2024-12-16 18:56:05 +00:00
!!! tip
2024-10-06 11:29:17 -03:00
2024-12-16 18:56:05 +00:00
Before removing the binaries, you may want to remove any data that uv has stored.
2024-08-22 18:04:34 -05:00
2024-12-16 18:56:05 +00:00
2. Remove the uv and uvx binaries:
2024-08-22 18:04:34 -05:00
2024-12-16 18:56:05 +00:00
=== "macOS and Linux"
2024-08-22 18:04:34 -05:00
2024-12-16 18:56:05 +00:00
` ``console
$ rm ~/.local/bin/uv ~/.local/bin/uvx
` ``
2024-08-22 18:04:34 -05:00
2024-12-16 18:56:05 +00:00
=== "Windows"
` ``powershell
$ rm $HOME\.local\bin\uv.exe
$ rm $HOME\.local\bin\uvx.exe
` ``
!!! note
2024-11-08 07:28:38 -06:00
2024-12-16 18:56:05 +00:00
Prior to 0.5.0, uv was installed into ` ~/.cargo/bin`. The binaries can be removed from there to
uninstall. Upgrading from an older version will not automatically remove the binaries from
` ~/.cargo/bin`.
2024-11-08 07:28:38 -06:00
2024-08-06 13:48:04 -05:00
## Next steps
2024-08-09 12:31:10 -05:00
See the [first steps ](./first-steps.md ) or jump straight to the [guides ](../guides/index.md ) to
start using uv.