Fabric is best installed via pip (highly recommended) or easy_install (older, but still works fine). You may also opt to use your operating system’s package manager (the package is typically called fabric or python-fabric), or execute python setup.py install inside a downloaded or cloned copy of the source code.
In order for Fabric’s installation to succeed, you will need four primary pieces of software:
Please read on for important details on each dependency – there are a few gotchas.
Fabric requires Python version 2.5 or 2.6. Some caveats and notes about other Python versions:
Setuptools comes with some Python installations by default; if yours doesn’t, you’ll need to grab it. In such situations it’s typically packaged as python-setuptools, py25-setuptools or similar. Fabric may drop its setuptools dependency in the future, or include alternative support for the Distribute project, but for now setuptools is required for installation.
PyCrypto is a dependency of Paramiko which provides the low-level (C-based) encryption algorithms used to run SSH. There are a couple gotchas associated with installing PyCrypto: its compatibility with Python’s package tools, and the fact that it is a C-based extension.
We strongly recommend using pip to install Fabric as it is newer and generally better than easy_install. However, a combination of bugs in specific versions of Python, pip and PyCrypto can prevent installation of PyCrypto. Specifically:
When all three criteria are met, you may encounter No such file or directory IOErrors when trying to pip install Fabric or pip install PyCrypto.
The fix is simply to make sure at least one of the above criteria is not met, by doing the following (in order of preference):
Unless you are installing from a precompiled source such as a Debian apt repository or RedHat RPM, or using pypm, you will also need the ability to build Python C-based modules from source in order to install PyCrypto. Users on Unix-based platforms such as Ubuntu or Mac OS X will need the traditional C build toolchain installed (e.g. Developer Tools / XCode Tools on the Mac, or the build-essential package on Ubuntu or Debian Linux – basically, anything with gcc, make and so forth) as well as the Python development libraries, often named python-dev or similar.
For Windows users we recommend using ActivePython and PyPM, installing a C development environment such as Cygwin or obtaining a precompiled Win32 PyCrypto package from voidspace’s Python modules page.
Some Windows users whose Python is 64-bit have found that the PyCrypto dependency winrandom may not install properly, leading to ImportErrors. In this scenario, you’ll probably need to compile winrandom yourself via e.g. MS Visual Studio. See #194 for info.
If you are interested in doing development work on Fabric (or even just running the test suite), you may also need to install some or all of the following packages:
For an up-to-date list of exact testing/development requirements, including version numbers, please see the requirements.txt file included with the source distribution. This file is intended to be used with pip, e.g. pip install -r requirements.txt.
To obtain a tar.gz or zip archive of the Fabric source code, you may visit either of the following locations:
The Fabric developers manage the project’s source code with the Git DVCS. To follow Fabric’s development via Git instead of downloading official releases, you have the following options:
If you’ve obtained the Fabric source via source control and plan on updating your checkout in the future, we highly suggest using python setup.py develop instead – it will use symbolic links instead of file copies, ensuring that imports of the library or use of the command-line tool will always refer to your checkout.
For information on the hows and whys of Fabric development, including which branches may be of interest and how you can help out, please see the Development page.
Windows users who already have ActiveState’s ActivePython distribution installed may find Fabric is best installed with its package manager, PyPM. Below is example output from an installation of Fabric 0.9.4 via pypm:
C:\> pypm install fabric The following packages will be installed into "%APPDATA%\Python" (2.7): paramiko-1.7.6 pycrypto-2.0.1 fabric-0.9.4 Get: [pypm-free.activestate.com] fabric 0.9.4 Get: [pypm-free.activestate.com] paramiko 1.7.6 Get: [pypm-free.activestate.com] pycrypto 2.0.1 Installing paramiko-1.7.6 Installing pycrypto-2.0.1 Installing fabric-0.9.4 Fixing script %APPDATA%\Python\Scripts\fab-script.py C:\>