Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems installing M2Crypto on Mint: follow-up

I asked a question here regarding installing the M2Crypto python library in Mint. That question was answered successfully and I was able to build and install M2Crypto. However, I am not able to use it within Python. when I attempt to import the module, I get the following error:

>>> import M2Crypto
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/M2Crypto/__init__.py", line 22, in <module>
    import __m2crypto
ImportError: /usr/local/lib/python2.7/dist-packages/M2Crypto/__m2crypto.so: undefined symbol: SSLv2_method

If anyone know how to resolve this error, please let me know.

like image 289
ewok Avatar asked Nov 30 '22 14:11

ewok


2 Answers

After two years the problem in m2crypto0.21.1 still exists, so here is a note for Ubuntu users. If you're not using virtualenv, you can easily fix it by installing m2crypto from Ubuntu PPA instead of pip:

sudo pip uninstall m2crypto 
sudo apt-get install python-m2crypto

Seems like the problem is fixed in the PPA, but not in the project's repo. At least it worked for me at Ubuntu 12.04.

like image 80
alexykot Avatar answered Dec 06 '22 00:12

alexykot


To expand the answer above:

This is a bug in M2Crypto 0.21.1. It has to do with the fact that SSLv2 was removed from OpenSSL on many platforms on the grounds of it being too insecure, notably Debian [1] and Ubuntu.

The removal is not detected during compile. There is a widely available patch that fixes this. I incorporated this into the M2Crypto source code on Github.

You can use pip to install directly from the repository like so:

pip install -e git+https://github.com/Hypernode/m2crypto#egg=M2Crypto

For those who want to inspect the (much published) patch that fixes this: b432d36

Edit: moved to another location

like image 25
Allard Hoeve Avatar answered Dec 06 '22 00:12

Allard Hoeve