Jan 30 2014

Installing Paramiko for Python 2.7 on Windows 8.1

Published by at 6:22 pm under Programming,Python

I have the need to write a couple of Python skripts that can login to Linux servers via ssh and do some “magic” there. Like, for example, restart a stopped snmpd daemon. Or something like that. From what I’ve read, the Paramiko module for Python will be my friend here.

The problem is that those Python modules will be triggered from a monitoring server running on 64-Bit Windows 2008, and my daily workhorse and development machine is running 64-Bit Windows 8.1. Accordingly, I also prefer to use the 64-Bit version of Python. (Just because, there is no real technical reason for that at this point in time.)

I found these websites indispensable when it comes to Windows-installers for certain Python packages:

http://blog.newitfarmer.com/python/library/10781/repost-unofficial-windows-binaries-for-python-extension-packages

http://www.lfd.uci.edu/~gohlke/pythonlibs/

What you need from there are the packages named Base-13.2.11-<xyz> and pip.

In Windows, you should enhance your PATH variable not only to include the Python installation directory, but also to include the Python\Scripts directory as well – because then you can run commands like “pip install paramiko” from the command line.

Paramiko depends on the “Crypto” module, which it will implicitly load when you execute “import paramiko” in Python. A Windows installer for this package can be found here:

http://www.voidspace.org.uk/python/modules.shtml#pycrypto

Download the file and run it.

The fun part is that either Python or Windows 8.1 itself are quite case sensitive. The pycrypto Windows installer creates a lower-case folder “crypto”, but Paramiko uses an upper-case name to load the “Crypto” module. While this will work on Windows Server 2008 regardless, it will fail on Windows 8.1. So you have to go to the Python\Lib\site-packages folder and rename the folder “crypto” to “Crypto”.

After that, install the Paramiko module via “pip install paramiko”.

Now you can launch the Python interpreter and type “import paramiko”. If Python shows you the interpreter prompt without any messages at all, you should have a working Paramiko installation.

No responses yet

Trackback URI | Comments RSS

Leave a Reply