georgebrock/1pass

M2Crypto version

Closed this issue · 5 comments

Hi, I'm install this on Mac OSX 10.10. I have the following error. What version of M2Crypto are you using? This seems like I could have an incorrect version. I have version 0.21.1. Thanks.

$ 1pass
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fuzzywuzzy/fuzz.py:33: UserWarning: Using slow pure-python SequenceMatcher
  warnings.warn('Using slow pure-python SequenceMatcher')
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/1pass", line 7, in <module>
    import onepassword.cli
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/onepassword/__init__.py", line 1, in <module>
    from keychain import Keychain
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/onepassword/keychain.py", line 5, in <module>
    from onepassword.encryption_key import EncryptionKey
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/onepassword/encryption_key.py", line 3, in <module>
    from M2Crypto import EVP
  File "build/bdist.macosx-10.6-intel/egg/M2Crypto/__init__.py", line 24, in <module>
  File "build/bdist.macosx-10.6-intel/egg/M2Crypto/ASN1.py", line 12, in <module>
  File "build/bdist.macosx-10.6-intel/egg/M2Crypto/BIO.py", line 221, in <module>
  File "build/bdist.macosx-10.6-intel/egg/M2Crypto/BIO.py", line 227, in CipherStream
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'

Update: I was able to install M2Crypto using conda (I was trying with pip before, which was failing).

brew install homebrew/versions/swig304
sudo -H pip install M2Crypto

worked fine for me

I had this swig/m2crypto issue before, then installed swig304 as lucianf described. In a brand new virtualenv, I attempt to install 1pass, but still get the error below, which appears to be related to openssl. (I'm running OpenSSL 0.9.8zg 14 July 2015, installed with Homebrew).

Is this still related to the same issue? If not, is there a known solution, or should I post a new issue?

Thanks,
Jared

(test) ~ › pip install --no-cache-dir 1pass
Collecting 1pass
  Downloading 1pass-0.2.1.tar.gz
Collecting M2Crypto (from 1pass)
  Downloading M2Crypto-0.22.5.tar.gz (80kB)
    100% |████████████████████████████████| 81kB 6.8MB/s 
Collecting fuzzywuzzy (from 1pass)
  Downloading fuzzywuzzy-0.8.0.tar.gz
Installing collected packages: M2Crypto, fuzzywuzzy, 1pass
  Running setup.py install for M2Crypto
    Complete output from command /Users/jared/.virtualenvs/test/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/hg/rw4215851tl2g3t_z5hkd70r0000gn/T/pip-build-_1r3i3/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hg/rw4215851tl2g3t_z5hkd70r0000gn/T/pip-5_gtGp-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jared/.virtualenvs/test/bin/../include/site/python2.7/M2Crypto:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.11-x86_64-2.7
    creating build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/ASN1.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/AuthCookie.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/BIO.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/BN.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/callback.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/DH.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/DSA.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/EC.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/Engine.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/Err.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/EVP.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/ftpslib.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/httpslib.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/m2.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib2.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/m2xmlrpclib.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/Rand.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/RC4.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/RSA.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/SMIME.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/threading.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/util.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    copying M2Crypto/X509.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto
    creating build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/cb.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Checker.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Cipher.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Connection.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Context.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Session.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/SSLServer.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/timeout.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/SSL
    creating build/lib.macosx-10.11-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/constants.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/packet.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/PublicKey.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.macosx-10.11-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/RSA.py -> build/lib.macosx-10.11-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/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/include -includeall -modern -builtin -outdir build/lib.macosx-10.11-x86_64-2.7/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
    SWIG/_m2crypto.i:31: Error: Unable to find 'openssl/opensslv.h'
    SWIG/_m2crypto.i:45: Error: Unable to find 'openssl/safestack.h'
    SWIG/_evp.i:12: 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 "/Users/jared/.virtualenvs/test/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/hg/rw4215851tl2g3t_z5hkd70r0000gn/T/pip-build-_1r3i3/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hg/rw4215851tl2g3t_z5hkd70r0000gn/T/pip-5_gtGp-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jared/.virtualenvs/test/bin/../include/site/python2.7/M2Crypto" failed with error code 1 in /private/var/folders/hg/rw4215851tl2g3t_z5hkd70r0000gn/T/pip-build-_1r3i3/M2Crypto

Ran into this as well, but the install procedure documented by m2crypto worked for me on 10.12:

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

See also:
http://stackoverflow.com/questions/33005354/trouble-installing-m2crypto-with-pip-on-el-capitan

Thanks for documenting the workaround to this issue.

The latest version of 1pass (in github, not released to pip) no longer relies on m2crypto. I'll test it on OS X before the next pip release.