edwards-air:master emv$ salt --versions-report
Salt: 2014.7.2
Python: 2.7.9 (default, Dec 30 2014, 18:33:32)
Jinja2: 2.7.3
M2Crypto: 0.22
msgpack-python: 0.4.6
msgpack-pure: Not Installed
pycrypto: Not Installed
libnacl: Not Installed
PyYAML: 3.11
ioflo: Not Installed
PyZMQ: 14.5.0
RAET: Not Installed
ZMQ: 4.0.5
Mako: Not Installed
The underlying issue is here:
https://github.com/M2Crypto/M2Crypto/issues/24
https://github.com/swig/swig/issues/344
Essentially, on Mac OS X 10.9.5 (Mavericks) and Homebrew, M2Crypto fails to work because of compatibility problem with swig 3.0.5. The error you get is
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'
and the workaround on Homebrew is to uninstall swig 3.0.5, reinstall swig 3.0.4, and rebuild M2Crypto.
% brew tap homebrew/versions
% brew install swig304
% pip uninstall M2Crypto
% pip install M2Crypto
It looks like both swig and M2Crypto maintainers are actively sorting through this at the moment, but just to make sure that if someone else sees this....
Thanks very much for posting this information and for posting the upstream issues. I've seen this error before, but didn't look into it enough to find those references. I am sure this will be useful for others to know!
Combination of swig 304 and M2Crypto==0.21.1, works for me.
correct sequence for me :
% brew tap homebrew/versions
% brew install swig304
% brew unlink swig
% brew link swig304
% pip uninstall M2Crypto
% pip install M2Crypto
swig304 and M2Crypto==0.21.1 works for me (Mac OS X 10.9.5) as well, thanks @RajatGoyal
Based on the following thread, M2Crypto seems to not be supported anymore on OS X:
https://gitlab.com/m2crypto/m2crypto/issues/63
Would it be possible to use an alternative such as: https://github.com/pyca/cryptography ?
For me, os is mac OS X 10.11.1, swig304 and M2Crypto==0.21.1 install ok, but have a error:
Traceback (most recent call last):
File "conf/db_create.py", line 23, in <module>
from app import db
File "conf/../app/__init__.py", line 55, in <module>
import views
File "conf/../app/views.py", line 24, in <module>
from models import xxx
File "-conf/../app/models.py", line 23, in <module>
from M2Crypto.EVP import Cipher
File "xxx.virtualenvs/xxx/lib/python2.7/site-packages/M2Crypto/__init__.py", line 22, in <module>
import __m2crypto
ImportError: dlopen(xxx.virtualenvs/xxx/lib/python2.7/site-packages/M2Crypto/__m2crypto.so, 2): Symbol not found: _SSLv2_method
Referenced from:xxx.virtualenvs/xxx/lib/python2.7/site-packages/M2Crypto/__m2crypto.so
Expected in: flat namespace
in xxx/.virtualenvs/xxx/lib/python2.7/site-packages/M2Crypto/__m2crypto.so
Hello -- I've tried all the suggested solutions here and I still can't get M2Crypto to build successfully. Is it my python installation of Anaconda that is the problem?
Thanks
pip install M2Crypto
Collecting M2Crypto
Using cached M2Crypto-0.22.5.tar.gz
Building wheels for collected packages: M2Crypto
Running setup.py bdist_wheel for M2Crypto
Complete output from command /Users/User/anaconda/bin/python -c "import setuptools;file='/private/var/folders/6s/78ychxvj4734qlwfg0zbj7k00000gn/T/pip-build-r6zGrg/M2Crypto/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /var/folders/6s/78ychxvj4734qlwfg0zbj7k00000gn/T/tmpoKo2egpip-wheel-:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/init.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/ASN1.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/AuthCookie.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/BIO.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/BN.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/callback.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/DH.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/DSA.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/EC.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/Engine.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/Err.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/EVP.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/ftpslib.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/httpslib.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/m2.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/m2urllib.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/m2urllib2.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/m2xmlrpclib.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/Rand.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/RC4.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/RSA.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/SMIME.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/threading.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/util.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
copying M2Crypto/X509.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto
creating build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/init.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/cb.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Checker.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Cipher.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Connection.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Context.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Session.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/SSLServer.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/timeout.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/SSL
creating build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
copying M2Crypto/PGP/init.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
copying M2Crypto/PGP/constants.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
copying M2Crypto/PGP/packet.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
copying M2Crypto/PGP/PublicKey.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
copying M2Crypto/PGP/RSA.py -> build/lib.macosx-10.5-x86_64-2.7/M2Crypto/PGP
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/Users/User/anaconda/include/python2.7 -I/usr/include -includeall -modern -builtin -outdir build/lib.macosx-10.5-x86_64-2.7/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_bio.i:64: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_rand.i:21: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_evp.i:160: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_dh.i:36: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_rsa.i:43: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_dsa.i:31: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_ssl.i:237: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_ssl.i:238: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_x509.i:323: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_pkcs7.i:44: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_pkcs7.i:44: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_util.i:11: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_ec.i:111: Warning 454: Setting a pointer/reference variable may leak memory.
SWIG/_engine.i:168: Warning 454: Setting a pointer/reference variable may leak memory.
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/SWIG
gcc -fno-strict-aliasing -I/Users/User/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/User/anaconda/include/python2.7 -I/usr/include -I/private/var/folders/6s/78ychxvj4734qlwfg0zbj7k00000gn/T/pip-build-r6zGrg/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.macosx-10.5-x86_64-2.7/SWIG/_m2crypto_wrap.o -DTHREADING
SWIG/_m2crypto_wrap.c:7111:12: warning: incompatible pointer types returning '_LHASH _' (aka 'struct lhash_st *') from a function with result type 'struct lhash_st_CONF_VALUE *' [-Wincompatible-pointer-types]
return lh_new(NULL, NULL); /_ Should probably be lh_CONF_VALUE_new but won't compile. _/
^~~~~~
SWIG/_m2crypto_wrap.c:8274:26: warning: incompatible pointer types assigning to 'int (_)(const void _, const void *)' from 'int (_)(const char _const *, const char *const *)' [-Wincompatible-pointer-types]
if (arg1) (arg1)->comp = arg2;
^ ~~~~
SWIG/_m2crypto_wrap.c:8338:3: error: unknown type name 'STACK'; did you mean '_STACK'?
STACK *arg1 = (STACK *) 0 ;
^
_STACK
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8338:18: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
STACK *arg1 = (STACK *) 0 ;
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8338:25: error: expected expression
STACK *arg1 = (STACK *) 0 ;
^
SWIG/_m2crypto_wrap.c:8349:11: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
arg1 = (STACK *)(argp1);
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8349:18: error: expected expression
arg1 = (STACK *)(argp1);
^
SWIG/_m2crypto_wrap.c:8360:3: error: unknown type name 'STACK'; did you mean '_STACK'?
STACK *arg1 = (STACK *) 0 ;
^~~~~
_STACK
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8360:18: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
STACK *arg1 = (STACK *) 0 ;
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8360:25: error: expected expression
STACK *arg1 = (STACK *) 0 ;
^
SWIG/_m2crypto_wrap.c:8375:11: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
arg1 = (STACK *)(argp1);
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8375:18: error: expected expression
arg1 = (STACK *)(argp1);
^
SWIG/_m2crypto_wrap.c:8391:3: error: unknown type name 'STACK'; did you mean '_STACK'?
STACK *arg1 = (STACK *) 0 ;
^
_STACK
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8391:18: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
STACK *arg1 = (STACK *) 0 ;
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8391:25: error: expected expression
STACK *arg1 = (STACK *) 0 ;
^
SWIG/_m2crypto_wrap.c:8411:11: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
arg1 = (STACK *)(argp1);
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8411:18: error: expected expression
arg1 = (STACK *)(argp1);
^
SWIG/_m2crypto_wrap.c:8436:3: error: unknown type name 'STACK'; did you mean '_STACK'?
STACK *result = 0 ;
^~~~~
_STACK
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8445:13: error: use of undeclared identifier 'STACK'; did you mean '_STACK'?
result = (STACK *)sk_new(arg1);
^
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead _/
^
SWIG/_m2crypto_wrap.c:8445:20: error: expected expression
result = (STACK *)sk_new(arg1);
^
SWIG/_m2crypto_wrap.c:8455:3: error: unknown type name 'STACK'; did you mean '_STACK'?
STACK *result = 0 ;
^
_STACK
/Users/User/anaconda/include/openssl/stack.h:72:3: note: '_STACK' declared here
} _STACK; /_ Use STACK_OF(...) instead */
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
error: command 'gcc' failed with exit status 1
Failed building wheel for M2Crypto
Failed to build M2Crypto
Based on the following thread, M2Crypto seems to not be supported anymore on OS X:
@ogrisel that's unfair characterization of the situation. We have problems with lack of users of Mac OS X who would be willing and able to help, test, etc., but we certainly do want to support OS X and we haven't got up yet. If you cannot M2Crypto from the master
branch of https://gitlab.com/m2crypto/m2crypto/ you are welcome to file a ticket at our issue tracker, and I will give it a try (especially if you help me with testing).
Getting this error on pip install m2crypto
n2.7 -I/usr/include -includeall -modern -builtin -outdir /private/var/folders/8t/k_186ygs5yv2ygbtnr66zlk00000gn/T/pip-build-0ywOnQ/M2Crypto/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_m2crypto.i:32: Error: Unable to find 'openssl/opensslv.h'
SWIG/_m2crypto.i:46: Error: Unable to find 'openssl/safestack.h'
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_rc4.i:5: 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
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8t/k_186ygs5yv2ygbtnr66zlk00000gn/T/pip-build-0ywOnQ/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/8t/k_186ygs5yv2ygbtnr66zlk00000gn/T/pip-4u2Bzt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/8t/k_186ygs5yv2ygbtnr66zlk00000gn/T/pip-build-0ywOnQ/M2Crypto/
@Nisar1990 You seem to be doing too much. I have released the new version of M2Crypto couple of days ago. If you follow the installation instructions, are you able to install M2Crypto?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Most helpful comment
@Nisar1990 You seem to be doing too much. I have released the new version of M2Crypto couple of days ago. If you follow the installation instructions, are you able to install M2Crypto?