pythoninstallationpipm2crypto

pip install python-adb failed


I want to install Python-adb using pip V9.0.3.

When Im trying to install python-adb, but I always get the same error as you can see at the bottom.
I also tried it installing it per CMD with admin rights on pip/pip3.

What I already tried:
- CMD with/without admin rights
- pip/pip3 installation
- installed mingw for C++ errors

Im currently using Python3.6 on Windows 7 64Bit

Output:

Collecting python-adb
  Using cached python_adb-1.1.1-py3-none-any.whl
Requirement already satisfied: libusb1>=1.0.16 in c:\users\alex\appdata\local\programs\python\python
36\lib\site-packages (from python-adb)
Collecting M2Crypto>=0.21.1 (from python-adb)
  Using cached M2Crypto-0.29.0.tar.gz
Requirement already satisfied: six in c:\users\alex\appdata\local\programs\python\python36\lib\site-
packages (from python-adb)
Installing collected packages: M2Crypto, python-adb
  Running setup.py install for M2Crypto ... error
    Complete output from command c:\users\alex\appdata\local\programs\python\python36\python.exe -u
-c "import setuptools, tokenize;__file__='C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-build-nwjmz2a0\
\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 C:\Users\Alex\AppData\Local\Temp\
pip-1s9ml6zw-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    copying M2Crypto\ASN1.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\AuthCookie.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\BIO.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\BN.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\callback.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\DH.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\DSA.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\EC.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\Engine.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\Err.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\EVP.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\ftpslib.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\httpslib.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\m2.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\m2crypto.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\m2urllib.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\m2urllib2.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\m2xmlrpclib.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\Rand.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\RC4.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\RSA.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\six.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\SMIME.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\threading.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\util.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\X509.py -> build\lib.win-amd64-3.6\M2Crypto
    copying M2Crypto\__init__.py -> build\lib.win-amd64-3.6\M2Crypto
    creating build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\cb.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\Checker.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\Cipher.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\Connection.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\Context.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\Session.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\SSLServer.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\ssl_dispatcher.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\timeout.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\TwistedProtocolWrapper.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    copying M2Crypto\SSL\__init__.py -> build\lib.win-amd64-3.6\M2Crypto\SSL
    running build_ext
    building 'M2Crypto._m2crypto' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\SWIG
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /
GL /DNDEBUG /MD -Ic:\users\alex\appdata\local\programs\python\python36\include -Ic:\users\alex\appda
ta\local\programs\python\python36\include -IC:\Users\Alex\AppData\Local\Temp\pip-build-nwjmz2a0\M2Cr
ypto\SWIG "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x8
6)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\sha
red" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8
.1\include\winrt" /TcSWIG/_m2crypto_wrap.c /Fobuild\temp.win-amd64-3.6\Release\SWIG/_m2crypto_wrap.o
bj -D_CRT_SECURE_NO_WARNINGS -DTHREADING
    _m2crypto_wrap.c
    SWIG/_m2crypto_wrap.c(3557): fatal error C1083: Cannot open include file: 'openssl/err.h': No su
ch file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.ex
e' failed with exit status 2

    ----------------------------------------
Command "c:\users\alex\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, t
okenize;__file__='C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-build-nwjmz2a0\\M2Crypto\\setup.py';f=g
etattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(
code, __file__, 'exec'))" install --record C:\Users\Alex\AppData\Local\Temp\pip-1s9ml6zw-record\inst
all-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\A
lex\AppData\Local\Temp\pip-build-nwjmz2a0\M2Crypto\

Solution

  • Apparently M2Crypto (which is where your install process is failing) is kind of hard to install on Windows, but there are unofficial binaries available (though that is a dated question), and the package's own install instructions include a section on Windows installation.

    More promisingly, there is a clone of the project here, which also has Windows instructions. But for that you'll need to have SWIG installed too.

    A third option is this pair (32-bit, 64-bit) of packages that are clones of M2Crypto specifically made for Windows, but I'm not sure how up-to-date they are (the last commit was in 2014, so there might have been a lot of changes to the original project by now).