Skip to content

Instantly share code, notes, and snippets.

@jennyq
Last active August 8, 2018 02:38
Show Gist options
  • Save jennyq/5671585 to your computer and use it in GitHub Desktop.
Save jennyq/5671585 to your computer and use it in GitHub Desktop.
Install m2crypto on Mac
When running "pip install m2crypto" in a virtualenv, I got the following error:
Downloading/unpacking m2crypto
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/System/Library/Frameworks/Python.framework/Versions/2.7/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 /Users/jqian/Code/git_repos/opensource/tendenci/t-jenny001/venv/bin/python -c "import setuptools;__file__='/Users/jqian/Code/git_repos/opensource/tendenci/t-jenny001/venv/build/m2crypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/d1/3k02zqcs5t7fhsfgnnklk8n80000gn/T/pip-wKewyY-record/install-record.txt --single-version-externally-managed --install-headers /Users/jqian/Code/git_repos/opensource/tendenci/t-jenny001/venv/include/site/python2.7:
running install
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/System/Library/Frameworks/Python.framework/Versions/2.7/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
Looks like it's complaining swig is not installed. I'm on Mac and have homebrew installed. So I ran the follwing commands to install the swig:
brew update
brew install https://raw.github.com/cobrateam/formulae/master/swig.rb
After swig is installed, install m2crypto:
pip install m2crypto
That fixed the problem.
Then
@wiserfirst
Copy link

You can just use brew install swig to install swig

@tarunbhardwaj
Copy link

Not working now. installed old version

pip install M2Crypto==0.21.1

@gobos
Copy link

gobos commented Dec 5, 2015

@arunbhardwaj you solution works, thx.

@tristan2077
Copy link

sudo apt install swig
ubuntu use the fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment