LinuxCommandLibrary

pipx

Install and run Python applications in isolated environments

TLDR

Run an app in a temporary virtual environment

$ pipx run [pycowsay] [moo]
copy

Install a package in a virtual environment and add entry points to path
$ pipx install [package]
copy

List installed packages
$ pipx list
copy

Run an app in a temporary virtual environment with a package name different from the executable
$ pipx run --spec [httpx-cli] [httpx] [http://www.github.com]
copy

Inject dependencies into an existing virtual environment
$ pipx inject [package] [dependency1 dependency2 ...]
copy

Install a package in a virtual environment with pip arguments
$ pipx install --pip-args='[pip-args]' [package]
copy

Upgrade/reinstall/uninstall all installed packages
$ pipx [upgrade-all|uninstall-all|reinstall-all]
copy

SYNOPSIS

pipx [OPTIONS] COMMAND [ARGS]...

Common commands: install, run, list, uninstall

PARAMETERS

--help
    Show help message and exit

--version
    Show pipx version and exit

-v, --verbose
    Increase verbosity (repeatable)

--include-deps
    Include subdependencies during upgrade/reinstall

--pip-args TEXT
    Extra arguments for pip (e.g., '--pip-args="--index-url foo"')

--venv-args TEXT
    Extra arguments for venv module

--suffix TEXT
    Custom suffix for venv directory names

--noconfirm
    Skip interactive confirmation prompts

--force
    Overwrite existing installation (same version OK)

DESCRIPTION

Pipx is a dedicated Python package installer that deploys Python applications—one app per isolated environment—using the built-in venv module. It prevents dependency conflicts by running each app in its own virtual environment, while making the app's binaries available globally via symlinks in ~/.local/bin (on Linux/macOS).

Designed for CLI tools like black, mypy, poetry, or cookiecutter, pipx simplifies installing and running pure Python packages without polluting the system Python or user site-packages. It handles discovery via PyPI, installation, upgrades, and uninstallation seamlessly.

Key benefits include reproducibility, isolation, and ease of management. Pipx ensures apps see only their own dependencies, supports injecting extra packages into existing installs, and allows temporary runs without permanent installation. It's recommended by the Python Packaging Authority (PyPA) for user-installed Python apps.

CAVEATS

Requires Python 3.7+; venvs stored in ~/.local/share/pipx (customizable via PIPX_HOME); does not install editable or dev dependencies; ensure ~/.local/bin in $PATH for binaries.

DEFAULT PATHS

Venvs: $PIPX_HOME/venvs (~/.local/share/pipx/venvs)
Binaries: $PIPX_BIN_DIR (~/.local/bin)

INSTALLATION

Install via python -m pip install --user pipx, then pipx ensurepath

HISTORY

Created by Kevin McCarthy in 2018; first PyPI release 2019-01. Now maintained by PyPA. Gained popularity as best practice for Python CLI tools, with active development for Windows/macOS/Linux support.

SEE ALSO

pip(1), venv(1), virtualenv(1), poetry(1)

Copied to clipboard