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
PARAMETERS
install
Install one or more Python packages into isolated virtual environments.
uninstall
Uninstall a package and its associated virtual environment.
upgrade
Upgrade a package to the latest version.
upgrade-all
Upgrade all installed packages to their latest versions.
run
Run a command from a package that is not installed via pipx.
list
List all installed packages and their associated virtual environments.
inject
Inject packages into an existing pipx environment.
uninstall-all
Uninstall all packages installed with pipx.
--python
Specify the Python interpreter to use for the virtual environment.
--spec
Specify a particular version or URL for installation.
--include-deps
Include development dependencies when installing packages with CLI scripts.
--force
Overwrite existing files or virtual environments.
(Use with caution!).
--index-url
Base URL of Python Package Index (default https://pypi.org/simple).
--editable
Install a package in editable mode (only applies to install command).
--system-site-packages
Give the virtual environment access to the system site-packages dir.
DESCRIPTION
pipx is a command-line tool for installing and running Python applications in isolated virtual environments. It's specifically designed to prevent dependency conflicts between different Python applications. Instead of installing applications globally (which can lead to problems), pipx creates a separate virtual environment for each application.
This makes it safe to install multiple versions of the same application or applications that have conflicting dependencies. Once an application is installed with pipx, you can easily run it from anywhere on your system, thanks to pipx automatically adding the application's executable to your PATH. It's a convenient and reliable way to manage Python-based command-line tools.
CAVEATS
Packages installed with pipx are isolated. If an application needs to access other applications, consider using a different approach (e.g., packaging as a library). Upgrading can sometimes fail if there are conflicts or issues with the package's dependencies.
Always check the output messages for detailed information.
UNDERSTANDING PATH
pipx automatically manages your PATH environment variable, making it easier to access installed applications. However, changes to PATH may require a new terminal session to take effect.
BEST PRACTICES
It's generally recommended to use pipx for installing applications intended for command-line use. For libraries that are imported into your Python projects, use pip within a project-specific virtual environment.
HISTORY
pipx was created to address the limitations of installing Python applications globally with pip, especially regarding dependency conflicts. It provides a more robust and isolated approach. It has gained popularity as a reliable method for managing command-line tools written in Python.
SEE ALSO
venv(1), virtualenv(1), pip(1)