pipx module manages Python applications in isolated environments using pipx.
pipx is designed for installing Python applications, not libraries. Each application is installed in its own isolated environment.
Functions
packages
Install, remove, or update pipx packages.List of packages (PEP-508 format) to ensure.
Whether the packages should be installed.
Whether to upgrade packages without a specified version.
Additional arguments to the pipx command.
Package versions can be pinned like pip:
<pkg>==<version>pipx supports only one package name at a time, but the operation handles lists automatically.
Example
upgrade_all
Upgrade all pipx packages.ensure_path
Ensure pipx bin directory is in the PATH.This operation checks if the pipx bin directory is already in PATH before making changes.
Common Use Cases
Install Development Tools
Install with Specific Versions
Keep Tools Updated
Install pyinfra Itself
Install with Extras
Remove Tools
pipx-Specific Tips
pipx vs pip
pipx vs pip
When to use pipx:
- Installing command-line tools (black, flake8, poetry, etc.)
- Applications that should be isolated from other Python environments
- Tools you want available system-wide
- Installing libraries for development
- Project dependencies in a virtualenv
- Packages that don’t provide CLI tools
Injecting Packages
Injecting Packages
Add packages to existing pipx environments:
Running Applications
Running Applications
Run applications without installing:
List Installed Packages
List Installed Packages
View installed pipx packages:
Reinstall Packages
Reinstall Packages
Reinstall packages to fix issues:
Best Practices
Use for Global Tools Only
Use for Global Tools Only
Keep Tools Updated
Keep Tools Updated
Ensure PATH Configuration
Ensure PATH Configuration
Important Notes
Package names are compared using lowercase as per PEP-0426.
pipx requires Python 3.6+ to be installed on the system.
