Skip to main content
This guide covers all the ways to install pyinfra and get your development environment ready.

System Requirements

Before installing pyinfra, ensure your system meets these requirements:
pyinfra requires Python 3.10 or higher. Supported versions:
  • Python 3.10
  • Python 3.11
  • Python 3.12
  • Python 3.13
Check your Python version:
pyinfra works on:
  • Linux (all major distributions)
  • macOS (Intel and Apple Silicon)
  • Windows (via WSL2 recommended)
The tool itself is OS-independent, but targets POSIX-compatible systems (Linux/BSD/macOS).
pyinfra will automatically install these Python dependencies:
  • gevent>=1.5 - Concurrent execution engine
  • paramiko>=2.7,<4 - SSH connectivity
  • click>2 - CLI framework
  • jinja2>3,<4 - Template rendering
  • python-dateutil>2,<3 - Date handling
  • distro>=1.6,<2 - OS detection
  • packaging>=16.1 - Version parsing
  • pydantic>=2.11,<3 - Data validation

Installation Methods

uv is the fastest Python package installer. Install pyinfra as a tool:
Why uv? It’s significantly faster than pip, has better dependency resolution, and manages isolated tool environments automatically.

Using pipx

pipx installs Python CLI tools in isolated environments:
pipx is great if you want pyinfra available globally but isolated from other Python projects.

Using pip

Install with pip for traditional Python package management:
Installing with pip globally can cause conflicts with system packages. Consider using a virtual environment or pipx instead.

From Source

Install the latest development version directly from GitHub:
1

Clone the repository

2

Install with uv

3

Or install with pip

4

Verify installation

  • Access to unreleased features and bug fixes
  • Contributing to pyinfra development
  • Testing patches before official release
  • Custom modifications for your use case

Verifying Installation

After installation, verify everything works correctly:
1

Check version

You should see output like:
2

Test help command

This shows all available commands and options.
3

Run a simple test

Test local execution:
You should see:
If all three steps work, pyinfra is installed correctly!

Additional Setup

SSH Configuration

For SSH connectivity, ensure you have proper SSH setup:
pyinfra respects your ~/.ssh/config file. Configure connection settings there for easy access:
~/.ssh/config
Then use: pyinfra myserver deploy.py

Docker Setup (Optional)

To use the Docker connector, install Docker:
Test the Docker connector:

Enabling Shell Completion

pyinfra supports shell completion for bash, zsh, and fish:
Restart your shell or source the config file to enable completion.

Troubleshooting

Common Issues

Problem: The pyinfra command isn’t in your PATH.Solutions:
  1. If using pipx: Run pipx ensurepath and restart your shell
  2. If using pip —user: Add ~/.local/bin to your PATH:
  3. If using virtual environment: Make sure it’s activated:
Problem: Dependencies weren’t installed correctly.Solution: Reinstall with dependencies:
Problem: System Python is too old (< 3.10).Solutions:
  1. Install a newer Python version:
  2. Use pyenv to manage Python versions:
Problem: Trying to install globally without sudo.Solutions:
  1. Use pipx or uv (recommended)
  2. Use pip with —user flag:
  3. Use a virtual environment
Problem: Corporate proxy or firewall blocking PyPI.Solutions:
  1. Configure pip to use your proxy:
  2. Use your organization’s PyPI mirror:
Problem: Can’t connect to Docker daemon.Solutions:
  1. Ensure Docker is running:
  2. Add your user to the docker group:
  3. Check Docker socket permissions:

Upgrading pyinfra

Keep pyinfra up to date to get the latest features and bug fixes:
Check what’s new in the changelog.

Development Installation

For contributing to pyinfra or developing custom operations:
1

Clone and setup

2

Install with dev dependencies

3

Install pre-commit hooks

4

Run tests

Development dependencies include:
  • pytest and pytest-cov for testing
  • ruff for linting
  • mypy for type checking
  • ipython and ipdb for debugging

Uninstalling pyinfra

If you need to remove pyinfra:

Next Steps

Now that pyinfra is installed:

Quickstart Guide

Run your first deployment

Core Concepts

Understand how pyinfra works

CLI Reference

Master the command line interface

Operations

Explore available operations

Getting Help

If you encounter issues not covered here:

GitHub Issues

Report bugs and installation problems

GitHub Discussions

Ask questions and get community support

Matrix Chat

Real-time chat with the community

Contributing Guide

Learn how to contribute to pyinfra