from OpenSSL import crypto ImportError: cannot import name crypto

Asked by Shang Wang on 2012-03-30

Dear all:

I installed pyOpenSSL on the system, but when I do the import like the following:
from OpenSSL import crypto

I got following error:
ImportError: cannot import name crypto

Can anybody point out what have I missed? I installed pycrypto also, but doesn't seem to solve the problem. Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
pyOpenSSL Edit question
Assignee:
No assignee Edit question
Solved by:
Shang Wang
Solved:
2012-04-03
Last query:
2012-04-03
Last reply:
2012-04-03
Adi Roiban (adiroiban) said : #1

Hi Shang,

When reporting an error, please give more information about your installation.

What operatating system do you use?
What version OpenSSL library in installed on you system.
What version of pyOpenSSL are you using and which method did you used for installing pyOpenSSL

Cheers,
Adi

Shang Wang (shangwangnyu) said : #2

Dear Adi:

Thanks for the instruction. To be more specific, I use Ubuntu 11.10 version as the OS. The version of my OpenSSL installed is "OpenSSL 1.0.0e 6 Sep 2011". The version of pyOpenSSL that I use is 0.11. Thanks.

Jean-Paul Calderone (exarkun) said : #3

What's the output of this shell command?

    python -c 'from OpenSSL import __file__; print __file__'

eg, on my system:

    exarkun@top:~$ python -c 'from OpenSSL import __file__; print __file__'
    /home/exarkun/.local/lib/python2.7/site-packages/OpenSSL/__init__.pyc
    exarkun@top:~$

Adi Roiban (adiroiban) said : #4

In Ubuntu there are both OpenSSL 0.9.8 and 1.0.0.

Maybe pyOpenSSL 0.11 was compiles for OpenSSL 0.9.8 .

Try to get OpenSSL 0.9.8 on your system: sudo apt-get install libssl0.9.8

Shang Wang (shangwangnyu) said : #5

I finally resolve this problem by removing the version that I installed from source completely and use apt-get to download from repository. Current version is 0.12. Thanks everybody for the help.

Daira Hopwood (daira) said : #6

This issue was occurring for the Linux x64 pyOpenSSL 0.13 eggs that were hosted at https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-dep-eggs/README.html . I fixed that by rebuilding the eggs (so the ones that are there now don't have this problem). It seems to be easy to end up with a broken egg or build that is linked against the wrong OpenSSL lib, but I don't know what I did differently to prevent that; I didn't do anything special when building the new eggs.