I am running python 2.6 on Red Hat 6.4
I had a script running on one machine using paramiko sftp. When I transferred it to another machine I got an exception: SFTP file has no attribute __exit__
(something along those lines).
I decided to upgrade paramiko (thought it would solve the problem) with pip. Now I am getting this the moment I run a python script:
...
File "/usr/lib/python2.6/site-packages/paramiko/__init__.py", line 64, in <module>
from transport import SecurityOptions, Transport
File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 33, in <module>
from paramiko import util
File "/usr/lib/python2.6/site-packages/paramiko/util.py", line 33, in <module>
from paramiko.common import *
File "/usr/lib/python2.6/site-packages/paramiko/common.py", line 98, in <module>
from Crypto import Random
File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in <module>
from Crypto.Random import _UserFriendlyRNG
File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
from Crypto.Random.Fortuna import FortunaAccumulator
File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
import FortunaGenerator
File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in <module>
from Crypto.Util.number import ceil_shift, exact_log2, exact_div
File "/usr/lib64/python2.6/site-packages/Crypto/Util/number.py", line 56, in <module>
if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
So help!!
It seems you have a mix of PyCrypto libraries installed in your system. This bug report on the PyCrypto trackiong system seems related:
My guess is that you have the python-crypto-2.0.1 RPM installed system-wide, and you didn't have gmp-devel installed when you built & installed a later version of PyCrypto, so you'reusing a newer version of PyCrypto with an older version of _fastmath.
You may try to do as suggested: install the gmp-devel
package and then PyCrypto with pip
.