Installing And Running Fabric On Windows

I recently had to setup Fabric ( for doing deployment from my Windows machine at home.
Setting it up under Linux is very very easy but for some reasons there are a number of
issues you have to overcome when installing on Windows. I followed this page to start:

First up a standard Python install (I used 2.6.2) and setup tools 0.6c11:

and create a simple fabric script (

 python |  copy |? 
from fabric.api import local, env, put
env.hosts = [""] = ['debug']
def deploy():
	print "Deploying...";
	put("fabtest.txt", "/tmp/fabtest.txt");
	print "All Done...";

From there:

 bash |  copy |? 
easy_install fabric

will result in:

 powershell |  copy |? 
Installed f:\python26\lib\site-packages\fabric-0.9.0-py2.6.egg
Processing dependencies for fabric
Searching for pycrypto>=1.9
Best match: pycrypto 2.0.1
Processing pycrypto-2.0.1.tar.gz
Running pycrypto-2.0.1\ -q bdist_egg --dist-dir f:\docume~1\admini~1\loc
error: Setup script exited with error: Unable to find vcvarsall.bat

You can solve this in a number of ways, the easiest of which is to install the binary for pycrypto manually from here:

Next, try running fabric using: fab -f deploy. This results in:

 powershell |  copy |? 
Traceback (most recent call last):
  File "F:\Python26\Scripts\", line 8, in <module>
    load_entry_point('fabric==0.9.0', 'console_scripts', 'fab')()
  File "f:\python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.p
y", line 277, in load_entry_point
  File "f:\python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.p
y", line 2180, in load_entry_point
  File "f:\python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.p
y", line 1913, in load
  File "build\bdist.win32\egg\fabric\", line 17, in <module>
  File "build\bdist.win32\egg\fabric\", line 9, in <module>
  File "build\bdist.win32\egg\fabric\", line 12, in <module>
  File "build\bdist.win32\egg\fabric\", line 125, in <module>
  File "build\bdist.win32\egg\fabric\", line 74, in _get_system_username
ImportError: No module named win32api

Install the pywin32 extensions from here:

and finally run fabric again (fab -f deploy), the script should run fine this time…

 powershell |  copy |? 
All Done...
Disconnecting from done.

About the author
Jonathan Holloway is a developer based in Bristol, UK working with Java and Python technologies in the area of data analysis.