Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing M2Crypto 0.20.1 on Python 2.6 on Ubuntu 14.04

Tags:

python

ubuntu

I need to compile and install M2Crypto 0.20.1 from source for Python 2.6 on Ubuntu 14.04. I can't migrate to Python2.7 right now but we're planning so. I installed Python2.6 from https://launchpad.net/~fkrull/+archive/deadsnakes. I have installed libssl-dev and python2.6-dev, file /usr/include/x86_64-linux-gnu/openssl/opensslconf.h has 644 as permissions and is owned by root.

However the setup.py install for M2Crypto fails as below:

Running setup.py install for M2Crypto
    building 'M2Crypto.__m2crypto' extension
    swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
    swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
    SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'
    SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
    error: command 'swig' failed with exit status 1
    Complete output from command /vagrant/venv/bin/python2.6 -c "import setuptools, tokenize;__file__='/vagrant/venv/build/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3vnOUl-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/venv/include/site/python2.6:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.6

creating build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/util.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.6/M2Crypto

creating build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

creating build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/__init__.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/RSA.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/packet.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/constants.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

running build_ext

building 'M2Crypto.__m2crypto' extension

swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c

swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i

SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'

SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'

error: command 'swig' failed with exit status 1

----------------------------------------
Cleaning up...
Command /vagrant/venv/bin/python2.6 -c "import setuptools, tokenize;__file__='/vagrant/venv/build/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3vnOUl-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/venv/include/site/python2.6 failed with error code 1 in /vagrant/venv/build/M2Crypto
Traceback (most recent call last):
  File "/vagrant/venv/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/vagrant/venv/lib/python2.6/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/vagrant/venv/lib/python2.6/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 39: ordinal not in range(128)

What could I be missing?

like image 477
chachan Avatar asked Dec 01 '22 19:12

chachan


1 Answers

The path is wrong. Try to do this:

cd /usr/include/openssl/
ln -s ../x86_64-linux-gnu/openssl/opensslconf.h .
like image 86
RobertoAllende Avatar answered Dec 03 '22 08:12

RobertoAllende