Skip to main content
The 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.
str | list[str]
List of packages (PEP-508 format) to ensure.
bool
default:true
Whether the packages should be installed.
bool
default:false
Whether to upgrade packages without a specified version.
str
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

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
When to use pip:
  • Installing libraries for development
  • Project dependencies in a virtualenv
  • Packages that don’t provide CLI tools
Add packages to existing pipx environments:
Run applications without installing:
View installed pipx packages:
Reinstall packages to fix issues:

Best Practices

Important Notes

Package names are compared using lowercase as per PEP-0426.
pipx requires Python 3.6+ to be installed on the system.
The ensure_path operation modifies the user’s shell configuration files. It should be run before installing packages.
Use pipx run for one-off executions without installing the package permanently.