Skip to main content

uv tool run

Run a command provided by a Python package in an isolated environment.

Aliases

  • uvx - Convenient shorthand for uv 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.
uvx is provided as a convenient alias for uv tool run. Their behavior is identical.

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

--from
string
Use the given package to provide the command. By default, the package name is assumed to match the command name.
-w, --with
string
Run with the given packages installed. Can be specified multiple times.
--with-editable
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.
--with-requirements
file
Run with the packages listed in the given files. Supports requirements.txt, .py files with inline metadata, and pylock.toml.

Constraints

-c, --constraint
file
Constrain versions using the given requirements files. Constraints files only control the version of a requirement but don’t trigger installation.
--override
file
Override versions using the given requirements files. Overrides force a specific version regardless of other requirements.
--build-constraint
file
Constrain build dependencies using the given requirements files when building source distributions.

Environment Options

--isolated
boolean
Run the tool in an isolated virtual environment, ignoring any already-installed tools.
--env-file
file
Load environment variables from a .env file. Can be provided multiple times, with subsequent files overriding previous values.
--no-env-file
boolean
Avoid reading environment variables from a .env file.

Python Options

-p, --python
string
The Python interpreter to use to build the run environment.See uv help python for details on Python discovery and supported request formats.
--python-platform
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).
This option is for advanced use cases. When specified, uv will select wheels compatible with the target platform, which may not be compatible with the current platform.

PyTorch Options

--torch-backend
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

--lfs
boolean
Whether to use Git LFS when adding a dependency from Git.

Advanced Options

--show-resolution
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