uv tool run
Run a command provided by a Python package in an isolated environment.Aliases
uvx- Convenient shorthand foruv tool run
Usage
Description
By default, the package to install is assumed to match the command name. The command name can include an exact version in the format<package>@<version>, e.g., uv tool run ruff@0.3.0.
If the tool was previously installed via uv tool install, the installed version will be used unless a version is requested or the --isolated flag is used.
Packages are installed into an ephemeral virtual environment in the uv cache directory.
Examples
Run a tool with default version
Run a specific version
Run a tool from a different package
Run with additional dependencies
Run Python in an isolated environment
Run with requirements file
Options
Package Selection
string
Use the given package to provide the command. By default, the package name is assumed to match the command name.
string
Run with the given packages installed. Can be specified multiple times.
path
Run with the given packages installed in editable mode. When used in a project, these dependencies will be layered on top of the tool’s environment in a separate, ephemeral environment.
file
Run with the packages listed in the given files. Supports
requirements.txt, .py files with inline metadata, and pylock.toml.Constraints
file
Constrain versions using the given requirements files. Constraints files only control the version of a requirement but don’t trigger installation.
file
Override versions using the given requirements files. Overrides force a specific version regardless of other requirements.
file
Constrain build dependencies using the given requirements files when building source distributions.
Environment Options
boolean
Run the tool in an isolated virtual environment, ignoring any already-installed tools.
file
Load environment variables from a
.env file. Can be provided multiple times, with subsequent files overriding previous values.boolean
Avoid reading environment variables from a
.env file.Python Options
string
The Python interpreter to use to build the run environment.See
uv help python for details on Python discovery and supported request formats.string
The platform for which requirements should be installed. Represented as a “target triple” (e.g.,
x86_64-unknown-linux-gnu or aarch64-apple-darwin).PyTorch Options
string
The backend to use when fetching packages in the PyTorch ecosystem (e.g.,
cpu, cu126, or auto).This option is in preview and may change in future releases.
Git Options
boolean
Whether to use Git LFS when adding a dependency from Git.
Advanced Options
boolean
Whether to show resolver and installer output from any environment modifications. By default, environment modifications are omitted but enabled under
--verbose.Version Specification
You can specify package versions in several ways:Exact version
Version constraint with —from
Latest version (default)
Extras Specification
Install packages with optional extras:Troubleshooting
Command not found
If a command isn’t found, ensure the package name matches the command or use--from:
Version conflicts
If you encounter version conflicts, use--isolated to ignore existing installations:
Cache issues
If you experience cache-related problems, clear the cache:Environment not activating
Ensure you’re not inside an active virtual environment that might interfere:See Also
- uv tool install - Install a tool for repeated use
- uv tool list - List installed tools
- uv tool uninstall - Uninstall a tool
- uv run - Run scripts in a project context