How to get Python m2Crypto to work with virtualenv?

I am trying to install M2Crypto so that I can create pkey in my web application. My hosting requirements dictate that I should use pip to install any dependencies. Installing m2crypto at the system level is not an option for me. I am using Mint 12 in development and will be deployed to heroku.

error: the "swig" command failed with exit status 1 looks like a problem, but Google did not help. Thoughts?

Dump

Downloading/unpacking m2crypto Downloading M2Crypto-0.21.1.tar.gz (413Kb): 413Kb downloaded Running setup.py egg_info for package m2crypto Installing collected packages: m2crypto 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.7 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i unable to execute swig: No such file or directory error: command 'swig' failed with exit status 1 Complete output from command /home/bob/.virtualenvs/my_app/bin/python -c "import setuptools;__file__='/home/bob/.virtualenvs/my_app/build/m2crypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-O1V45n-record/install-record.txt --install-headers /home/bob/.virtualenvs/my_app/include/site/python2.7: running install running build (....clip...) swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c swig -python -I/usr/include/python2.7 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i unable to execute swig: No such file or directory error: command 'swig' failed with exit status 1 ---------------------------------------- Command /home/bob/.virtualenvs/my_app/bin/python -c "import setuptools;__file__='/home/bob/.virtualenvs/my_app/build/m2crypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-O1V45n-record/install-record.txt --install-headers /home/bob/.virtualenvs/my_app/include/site/python2.7 failed with error code 1 in /home/bob/.virtualenvs/my_app/build/m2crypto 
+6
source share
4 answers

Your problem has nothing to do with virtualenv. You just did not set the swing.

Install swig using the distribution package manager and try reinstalling M2Crypto in virtualenv.

+12
source

My solution for pip install M2Crypto on my VirtualEnv on my OSX Mac was as follows:

A: Exit from a virtual file

B: Download Swig using the link below and follow the instructions in the INSTALL text document to install it.

http://sourceforge.net/projects/swig/?source=dlp

C: Install the PCRE developer version, but because she needed to run Swig. Follow the link below and the instructions in the INSTALL text document to install it.

http://sourceforge.net/projects/pcre/?source=dlp

D: go back to my virtualenv , which I tried to install M2Crypto in the first place, activate virtualenv and run:

 pip install M2Crypto 
+2
source

It looks like an error message says that swig could not be found. Is swig in your virtualenv and on your way?

In addition, to make M2Crypto work, you will need access to the OpenSSL installation. If you cannot connect to the system installation, you need to install it in your local virtualenv and specify your links / libraries / include for use.

0
source

Sorry, that was obscure. I think the problem is that the twig is not in your way. The error message says:

unable to run swig: no such file or directory

What happens if you run "swig" from the command line?

-1
source

Source: https://habr.com/ru/post/911766/


All Articles