2 Comments Installing And Running Fabric On Windows - 12/17/09
I recently had to setup Fabric (http://docs.fabfile.org/0.9.0/) 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:
http://docs.fabfile.org/0.9.0/installation.html
First up a standard Python install (I used 2.6.2) and setup tools 0.6c11:
http://pypi.python.org/pypi/setuptools
and create a simple fabric script (fabfile.py)
| Python | | copy | | ? |
from fabric.api import local, env, put |
env.hosts = ["elephant@babar.net:40"] |
env.show = ['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 |
Reading http://pypi.python.org/simple/pycrypto/ |
Reading http://pycrypto.sourceforge.net |
Reading http://www.amk.ca/python/code/crypto |
Best match: pycrypto 2.0.1 |
Downloading http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz |
Processing pycrypto-2.0.1.tar.gz |
Running pycrypto-2.0.1\setup.py -q bdist_egg --dist-dir f:\docume~1\admini~1\loc |
als~1\temp\easy_install-clrpu1\pycrypto-2.0.1\egg-dist-tmp-1wszmf |
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:
http://www.voidspace.org.uk/downloads/pycrypto-2.0.1.win32-py2.6.exe
Next, try running fabric using: fab -f fabfile.py deploy. This results in:
| PowerShell | | copy | | ? |
Traceback (most recent call last): |
File "F:\Python26\Scripts\fab-script.py", 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\main.py", line 17, in <module> |
File "build\bdist.win32\egg\fabric\api.py", line 9, in <module> |
File "build\bdist.win32\egg\fabric\context_managers.py", line 12, in <module> |
File "build\bdist.win32\egg\fabric\state.py", line 125, in <module> |
File "build\bdist.win32\egg\fabric\state.py", line 74, in _get_system_username |
ImportError: No module named win32api |
Install the pywin32 extensions from here:
http://sourceforge.net/projects/pywin32/files/
and finally run fabric again (fab -f fabfile.py deploy), the script should run fine this time…
| PowerShell | | copy | | ? |
All Done... |
Done. |
Disconnecting from babar.net:40... done. |