pipx
Install and run Python applications in isolated environments
TLDR
Run an app in a temporary virtual environment
Install a package in a virtual environment and add entry points to path
List installed packages
Run an app in a temporary virtual environment with a package name different from the executable
Inject dependencies into an existing virtual environment
Install a package in a virtual environment with pip arguments
Upgrade/reinstall/uninstall all installed packages
SYNOPSIS
pipx command [options] [args]
Examples:
pipx install package_name[extras]
pipx run package_name [args]
pipx upgrade-all
PARAMETERS
install package
Installs a package and its entry points into a new, isolated virtual environment.
run package [args]
Runs a Python application directly from a temporary virtual environment without installing it globally.
list
Lists all installed packages and their associated virtual environments.
upgrade package
Upgrades an installed package to its latest compatible version.
upgrade-all
Upgrades all currently installed packages managed by pipx.
uninstall package
Uninstalls a specified package and removes its virtual environment.
uninstall-all
Uninstalls all packages managed by pipx.
inject package_to_inject_into package_to_inject
Injects a package into an existing pipx environment (e.g., to add optional dependencies).
ensurepath
Ensures the pipx binaries directory is correctly added to your system's PATH variable.
DESCRIPTION
pipx is a tool designed to install and run Python applications globally, but in isolated environments. Unlike pip, which installs packages into the Python environment you're currently using (potentially causing dependency conflicts), pipx creates a separate virtual environment for each application it installs.
This ensures that the application and its dependencies don't interfere with your system's Python packages or other installed applications. It makes globally available command-line tools written in Python safe and easy to manage, preventing "dependency hell" often encountered when multiple Python applications require conflicting versions of the same library. pipx places executables directly on your PATH, allowing you to run them like any other command-line tool, while keeping their internal dependencies neatly isolated. It's ideal for tools like black, flake8, poetry, or awscli.
CAVEATS
While pipx provides excellent isolation for Python applications, it's crucial to ensure that its binary directory (typically ~/.local/bin) is correctly added to your system's PATH variable for executables to be found. Occasionally, users might confuse it with pip or venv; remember pipx is specifically for running applications rather than managing libraries for development projects. It also requires pip and python to be properly configured on your system first.
HOW IT WORKS
pipx leverages Python's built-in venv module to create a dedicated virtual environment for each application. When you install an application, pipx creates a venv, installs the application and its dependencies inside that venv, and then symlinks the application's main executable (entry point) into a user-specific binary directory (e.g., ~/.local/bin), which pipx helps add to your system's PATH. This setup ensures that the application's dependencies are entirely separate from other Python installations on your system, preventing conflicts.
HISTORY
pipx was created by Vinay Sajip and first released around late 2018 / early 2019. Its development was driven by the common frustration of "dependency hell" when installing multiple Python-based command-line tools globally using pip. Traditional pip global installations often led to conflicts between different applications requiring varying versions of shared dependencies. pipx emerged as a dedicated solution to this problem, providing robust isolation and a streamlined user experience for Python application users. It quickly gained popularity within the Python community for its effectiveness and simplicity.