Paramiko is no longer pure Python

Bug #402978 reported by anatoly techtonik
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
paramiko
Confirmed
Undecided
Unassigned

Bug Description

Paramiko claims that it is written entirely in python (no C or platform-dependent code), but it does depend on platform-dependent C code from pcrypto library and can't work without it.

> python -m easy_install paramiko
Searching for paramiko
Best match: paramiko 1.7.5
Processing paramiko-1.7.5-py2.6.egg
paramiko 1.7.5 is already the active version in easy-install.pth

Using c:\~env\python26\lib\site-packages\paramiko-1.7.5-py2.6.egg
Processing dependencies for paramiko
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 c:\\temp\easy_install-vj3cpf\pycrypto-2.0.1\egg-dist-tmp-jm0lsy
error: Setup script exited with error: Unable to find vcvarsall.bat

>>> import paramiko
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win32\egg\paramiko\__init__.py", line 69, in <module>
  File "build\bdist.win32\egg\paramiko\transport.py", line 32, in <module>
  File "build\bdist.win32\egg\paramiko\util.py", line 32, in <module>
  File "build\bdist.win32\egg\paramiko\common.py", line 98, in <module>
  File "build\bdist.win32\egg\paramiko\rng.py", line 23, in <module>
ImportError: No module named Crypto.Util.randpool

Revision history for this message
Éric St-Jean (esj) wrote :

Is your bug that it's not pure python, or that you can't easy_install it on windows???

Paramiko can be pure python and depend on third party c code... After all, it also depends on a python interpreter which isn't written in python. The os module isn't pure python. Just because you need third party, fairly standard libraries that are not pure python doesn't mean the module isn't pure python!

Now, if you can't install it on windows because it's not packaged properly, or another package is not available for the platform, that's an actual bug - can you clarify and perhaps change the bug title accordingly?

Revision history for this message
anatoly techtonik (techtonik) wrote :

I can't install it on windows, because it requires some code to be compiled from C sources (i.e. no Python pure).

It may depend on any C code from standard library, because it is already compiled, installed, running and is part of the Python. If it doesn't require anything else than the thing called "Python" to be installed on my machine - then I call it "Python pure" library. It it requires some code to be specifically compiled on my system (and it doesn't matter if the code is its own, or some complicated library) - then it is not Python pure solution.

Revision history for this message
Tim K. (timothy-kendon) wrote :

If it's off any use, the problem can be resolved by:

1. Getting the source of pycrypto ...
2. Building the pycrypto source with "python setup.py build --compiler=mingw32"
3. Installing the pycrypto module "python setup.py install"
4. Installing the paramiko package "python setup.py install"

This assumes that you have mingw32, which comes with packages such as pythonxy.

It would have been better (if possible?) to get the python build of paramiko to download and install pycrypto with the appropriate compiler flags. Anyway the above solution worked for me!

Revision history for this message
anatoly techtonik (techtonik) wrote :

It is not a solution - it is a workaround, because mingw32 distribution includes GNU C compiler.

Revision history for this message
Tim K. (timothy-kendon) wrote :

Well it does solve the installation problem, albeit with mingw32 (which is easily available for python)!

So that makes it a solution to the installation problem, which is what I was offering!

If you could install it, I can't see why you would bother to complain? Is being "pure python" so important to you?

Revision history for this message
anatoly techtonik (techtonik) wrote :

Thanks for helping with installation, but the module is not Python pure and it still matters.

1. Non Python pure module can only be used with CPython thus limiting the usage.
2. C modules may not cover all architectures where CPython runs
3. 3rd party C modules may introduce new bugs (buffer overflow insecurities) etc. that were not tested by PSF members
4. 'mingw' compiler is not official compiler suite for windows recommended by PSF for windows extensions, that also means compiled code is untested for security vulnerabilities
5. C modules are almost impossible to audit for vulnerabilities for Python developers

That's why being "pure python" is important. If paramiko wasn't the package that guarantees security and its services were not network exposed, I didn't bother to complain.

Revision history for this message
Brian Ealdwine (eode) wrote :

This bug affects me, too. It is inaccurate to claim to be "pure python" and to require any additional form of binary installation, whether that be in C, D, Eiffel, Fortran, Go, Haskell, or any other compiled (or uncompiled, for that matter) language other than Python. These are, by definition and structure, different languages than Python.

It wastes the time of anyone who requires an *actual* pure python installation, whether that be because they need to use easy_install, or because compiling binaries on a given system has been forbidden, either physically, with jailshell, or by terms of service.

Please, either fix this so this *is* pure Python, or stop claiming that it is.

Changed in paramiko:
status: New → Confirmed
Brian Ealdwine (eode)
summary: - no more Python pure
+ Paramiko is no longer pure Python
Revision history for this message
Jason Pratt (re9ot) wrote :

I got bitten by this as well.

I downloaded this and PyCrypto and just put the python package directories where I wanted to use them (since I was led to believe it was pure Python and didn't have any native code dependencies). Wrote up some quick code for transferring files via SFTP and discovered upon running the code that PyCrypto had components that needed to be compiled.

Now I find out that I might need to install MinGW just to compile PyCrypto! I'm working in Python partly to avoid all of these dependencies!

I was pretty excited to find a Python SSH library in pure Python, and disappointed to discover that the claim was not entirely true.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.