pipx vs uv tool: Installing Python CLI Apps

pipx vs uv tool compared: isolated installs for Python command-line apps, running tools once with pipx run or uvx, upgrades, and which one to pick.

If you already use uv, use uv tool; otherwise pipx does the same job well. Both install a Python command-line application such as Ruff, Black or yt-dlp into its own virtual environment and put the command on your PATH, and both can run a tool once without installing it.

At a glance

pipxuv tool
Install a toolpipx install ruffuv tool install ruff
Run once, no installpipx run ruffuvx ruff (same as uv tool run ruff)
Run a pinned version oncepipx run --spec 'ruff==0.6.0' ruffuvx ruff@0.6.0
Upgrade one toolpipx upgrade ruffuv tool upgrade ruff
Upgrade all toolspipx upgrade-alluv tool upgrade --all
List installed toolspipx listuv tool list
Remove a toolpipx uninstall ruffuv tool uninstall ruff
Fix PATHpipx ensurepathuv tool update-shell
Add a package to an installed toolpipx injectuv tool install --with (rebuilds the tool)
System-wide install--globalNot supported
Written inPythonRust
Environment creationuv if 0.9.17 or newer is found, else pip and venvuv

The command mapping, and the inject, system-wide and environment-creation rows, come from the comparison in pipx’s own documentation. The commands were run with pipx 1.18.13 and uv 0.13.7.

Why isolated installs matter

Installing a command-line tool with a plain global pip install puts it and its dependencies in the same environment as everything else. Two tools that need different versions of the same library will conflict, and an upgrade for one can break another. Both tools here give each application its own environment while exposing only its commands. For how environments work, see Python virtual environments explained, and for the Linux error that pushes people towards this approach, see how to fix externally-managed-environment.

pipx

pipx “installs and runs end-user Python applications in isolated environments”, in the words of its documentation. It needs Python 3.11 or newer. The documented install routes are brew install pipx on macOS, sudo apt install pipx on Ubuntu 23.04 or newer, sudo dnf install pipx on Fedora, and python3 -m pip install --user pipx elsewhere, each followed by pipx ensurepath.

pipx install ruff
pipx run cowsay -t hello
pipx upgrade-all

With uv 0.9.17 or newer on your PATH, pipx uses it to create environments, and the tool’s metadata records "backend": "uv". Without uv it falls back to pip and the standard-library venv, and you can force that with --backend pip. pipx can also install a tool under a standalone Python build downloaded from python-build-standalone (--fetch-python) when no local interpreter fits, or under any interpreter you name with --python.

uv tool

uv includes the same capability:

uv tool install ruff
uvx ruff check .
uv tool upgrade --all

Because uv manages Python versions too, uv tool install --python 3.13 ruff pins the interpreter, and uv tool list --show-python shows the result: ruff v0.17.3 [CPython 3.13.18]. If you already use uv for projects, this saves installing and updating a second tool. For how uv fits with the rest, see what uv is and Python package managers compared.

Running both

Both tools write command shims to ~/.local/bin by default and neither overwrites a command the other created. After pipx install ruff, running uv tool install ruff stops with error: Executable already exists: ruff (use --force to overwrite). Uninstall one copy, use --force, or point one tool at a different directory with PIPX_BIN_DIR or UV_TOOL_BIN_DIR.

Run once or install?

Use pipx run or uvx for tools you use rarely or want to try. The documentation notes some details:

  • uvx reuses its cached environments until you prune the cache (uv cache clean), ask for a new version (uvx black@latest) or pass --refresh. pipx run caches for 14 days and also accepts --refresh.
  • After uv tool install ruff, a plain uvx ruff reuses that installed environment instead of building a temporary one. Pass --isolated to avoid that.
  • uv tool ignores a project’s .python-version file. uv run honours it.

Which should you choose?

  • You use uv for projects and scripts: uv tool.
  • You need inject, --suffix, --global or man pages: pipx. Installing pipx[uv] keeps the pipx commands and gives you uv’s speed for creating environments.
  • You want the smallest toolset: either; they are built for the same job.

A related question is how to install tools your project needs for development, such as linters and test runners: those usually belong in the project as dev dependencies instead. See Docker for Python with uv for how that looks in containers.

Frequently Asked Questions

What is the difference between pipx and uv tool?

Both install a Python command-line tool into its own isolated virtual environment, put its commands on your PATH, and offer a run-once mode. pipx is a standalone tool written in Python that uses uv itself when uv 0.9.17 or newer is available. uv tool is part of uv, which also manages projects, scripts and Python versions.

Should I use pipx or uv tool?

If you already use uv, use uv tool, because it avoids a second tool. pipx’s own documentation says it wins when you need its extras: pipx inject, —suffix to keep two copies of a tool, —global system-wide installs, exposed man pages, or pipx install-all to move a set of tools between machines.

What does uvx do?

uvx is shorthand for uv tool run. It runs a tool from PyPI in a cached, isolated environment without installing it permanently, for example uvx ruff check .

What is the pipx equivalent of uvx?

pipx run. For example, pipx run ruff —version downloads Ruff into a temporary environment and runs it. With the pip backend, pipx keeps that temporary environment cached for 14 days.

Why not just use pip install for command-line tools?

A global pip install puts the tool and its dependencies into one shared environment, where versions can conflict with each other and with your projects. On systems whose Python is marked as externally managed, pip also refuses to install into it at all. Isolated installs keep each tool separate.