Unable to install M2Crypto on Mac M1

776 views Asked by At

I'm trying to install requirements.txt on Mac M1 in python, but I'm getting the stack trace below.

 Collecting m2crypto
      Using cached https://files.pythonhosted.org/packages/2c/52/c35ec79dd97a8ecf6b2bbd651df528abb47705def774a4a15b99977274e8/M2Crypto-0.38.0.tar.gz
    Requirement already satisfied: typing in /Users/kelvin/.pyenv/versions/2.7.18/lib/python2.7/site-packages (from m2crypto) (3.10.0.0)
    Installing collected packages: m2crypto
      Running setup.py install for m2crypto ... error
        ERROR: Command errored out with exit status 1:
         command: /Users/kelvin/.pyenv/versions/2.7.18/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/setup.py'"'"'; __file__='"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/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 /private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-record-k7um2g/install-record.txt --single-version-externally-managed --compile
             cwd: /private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/
        Complete output (66 lines):
        running install
        running build
        running build_py
        copying src/M2Crypto/callback.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/EVP.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/AuthCookie.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/ftpslib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/EC.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/httpslib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/X509.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/util.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/RSA.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/BIO.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/DH.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/__init__.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/threading.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/Rand.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/SMIME.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/Engine.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2xmlrpclib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/RC4.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2urllib2.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/DSA.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/six.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2urllib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/BN.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2crypto.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/Err.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/ASN1.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        creating build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/cb.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Session.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/timeout.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/__init__.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Cipher.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Connection.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Context.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/SSLServer.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/ssl_dispatcher.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Checker.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        running egg_info
        writing requirements to src/M2Crypto.egg-info/requires.txt
        writing src/M2Crypto.egg-info/PKG-INFO
        writing top-level names to src/M2Crypto.egg-info/top_level.txt
        writing dependency_links to src/M2Crypto.egg-info/dependency_links.txt
        reading manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
        reading manifest template 'MANIFEST.in'
        warning: no files found matching 'SWIG/*.i'
        warning: no files found matching 'SWIG/*.h'
        warning: no files found matching 'SWIG/*.def'
        warning: no files found matching 'SWIG/_m2crypto_wrap.c'
        warning: no files found matching 'M2Crypto/m2crypto.py'
        writing manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
        running build_ext
        building 'M2Crypto._m2crypto' extension
        swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
        swig -python -I/usr/local/include -I/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory) -I/usr/local/include -I/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory) -I/Users/kelvin/.pyenv/versions/2.7.18/include/python2.7 -I/usr/include/openssl -includeall -modern -builtin -outdir /private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/src/M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
        Deprecated command line option: -modern. This option is now always on.
        src/SWIG/_m2crypto.i:62: Error: Unable to find 'openssl/opensslv.h'
        src/SWIG/_m2crypto.i:68: Error: Unable to find 'openssl/safestack.h'
        src/SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
        src/SWIG/_rc4.i:5: Error: Unable to find 'openssl/opensslconf.h'
        src/SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
        error: command 'swig' failed with exit status 1
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /Users/kelvin/.pyenv/versions/2.7.18/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/setup.py'"'"'; __file__='"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/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 /private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-record-k7um2g/install-record.txt --single-version-externally-managed --compile Check the logs for full command output
1

There are 1 answers

1
Mddl On

Just in case you're still experiencing this - and because this post matched my search terms - the instructions at https://gitlab.com/m2crypto/m2crypto/-/blob/master/INSTALL.rst#macosx worked for me. In case that ever disappears, they were to

$ brew install openssl swig
$ LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" SWIG_FEATURES="-I$(brew --prefix openssl)/include" pip install m2crypto