How to Install fabric in Python
High level SSH command execution
pip install fabric
What is fabric?
High level SSH command execution
Fabric is a high level Python (2.7, 3.4+) library designed to execute shell commands remotely over SSH, yielding useful Python objects in return. It builds on top of (subprocess command execution and command-line features) and (SSH protocol implementation), extending their APIs to complement one another and provide additional functionality.
To find out what's new in this version of Fabric, please see `the changelog `.
The project maintainer keeps a `roadmap ` on his website.
Quick Start
Minimal example to get started with fabric:
import fabric
print(fabric.__version__)
Installation
pip (standard)
pip install fabric
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install fabric
pip3
pip3 install fabric
conda
conda install -c conda-forge fabric
Poetry
poetry add fabric
Dependencies
Installing fabric will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import fabric; print(fabric.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing fabric with pip.
ModuleNotFoundError: No module named 'fabric'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install fabric. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'fabric' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install fabric to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'fabric'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show fabric and upgrade with pip install --upgrade fabric.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install fabric. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user fabric
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org fabric
Recent Releases
| Version | Released |
|---|---|
3.2.3 latest |
2026-04-06 |
3.2.2 |
2023-08-31 |
3.2.0 |
2023-08-06 |
3.2.1 |
2023-08-06 |
3.1.0 |
2023-05-25 |
Manage fabric
Upgrade to latest version
pip install --upgrade fabric
Install a specific version
pip install fabric==3.2.3
Uninstall
pip uninstall fabric
Check what is installed
pip show fabric