Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
Install Ansible with pip in a Virtual Environment
Automation

Install Ansible with pip in a Virtual

Step-by-step guide to install Ansible on Any Linux. Copy-paste commands, verify installation, and configure for production.

LB
Luca Berton
ยท 1 min read

Here is how to install Ansible using pip and virtualenv in 2026. This method works on any OS.

Prerequisites

# Ensure Python 3.10+ is installed
python3 --version
# Create virtual environment
python3 -m venv ~/ansible-venv

# Activate
source ~/ansible-venv/bin/activate  # Linux/macOS
# .\ansible-venv\Scripts\activate    # Windows

# Install Ansible
pip install ansible

# Or install specific version
pip install ansible==9.0.0

# Or just ansible-core (minimal)
pip install ansible-core

Using pipx (Best for CLI Tools)

# Install pipx
python3 -m pip install --user pipx
python3 -m pipx ensurepath

# Install Ansible globally via pipx
pipx install --include-deps ansible

Verify

ansible --version
which ansible

Manage Versions

# Upgrade
pip install --upgrade ansible

# Install additional collections
ansible-galaxy collection install community.general
ansible-galaxy collection install amazon.aws
ansible-galaxy collection install azure.azcollection

# Requirements file
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml
#Ansible #Installation #Any Linux #Tutorial #DevOps
Share:
Ansible & Python Training

Need help with Ansible & Python Training?

Level up your automation skills with expert-led Ansible and Python training.

Learn more about Ansible & Python Training

Want to operate this yourself, in production?

Take the free AI Platform Engineer Readiness Scorecard to see which skills transfer โ€” then build a production-shaped AI platform in the 4-week Bootcamp.

Take the Scorecard โ†’
Luca Berton โ€” AI & Cloud Advisor, Docker Captain

Luca Berton

AI & Cloud Advisor ยท Docker Captain ยท KubeCon Speaker

15+ years in enterprise infrastructure. Author of 8 technical books, creator of Ansible Pilot (1M+ YouTube views, 648K site users). Former Red Hat engineer. Speaker at KubeCon EU 2026 and Red Hat Summit 2026.

Free 30-min AI & Cloud consultation

Book Now