Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCrypto install error on Windows

I am trying to install PyCrypto 2.6 Library on my computer. But I keep getting the following error

D:\Software\Python\package\pycrypto-2.6>python setup.py build
running build
running build_py
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

building 'Crypto.Random.OSRNG.winrandom' extension
error: Unable to find vcvarsall.bat

My System has Windows 8 Pro 64-bit, Visual Studio Enterprise 2012 and Python 3.3

To fix the error I tried to set the Environment Variable VS90COMNTOOLS=%VS110COMNTOOLS% as advised by fmuecke in the post error: Unable to find vcvarsall.bat but it didn't work for me.

Can any one please advise me how to fix this error.

FYI, I don't to install VC2008 etc..

like image 562
Khurram Majeed Avatar asked Dec 09 '12 12:12

Khurram Majeed


4 Answers

I managed to install PyCrypto 2.6 by using the prebuilt binary for Python3.3 from The Voidspace Python Modules.

It doesn't actually fix the error: Unable to find vcvarsall.bat for other package which don't have a prebuilt binaries available.

However it eliminates the need to build PyCrypto package, allowing me to install PyCrypto on my system without getting the error.

like image 126
Khurram Majeed Avatar answered Sep 27 '22 00:09

Khurram Majeed


I've just used

https://www.microsoft.com/en-gb/download/details.aspx?id=44266

with setuptools > 6.0 and run

'pip install pycrypto'

and it worked

like image 44
One Time Guest Avatar answered Sep 26 '22 00:09

One Time Guest


I know this is an old question, but I also need today much time to get paramiko wokring. I want to use Python 3.4 and on voidspace, there are no prebuild binaries for 3.4.

Finally, I got a wokring pycrypto by installing "Microsoft Studio Express 2010 C++" and run from the pycrypto 2.7 folder:

python setup.py build --compiler msvc
python setup.py install
python setup.py bdist_wininst

All the "tricks" with enviroment variables doesn't work for me.

If it helps somebody, all the thanks goes to: http://flintux.wordpress.com/2014/04/30/pycrypto-for-python-3-4-on-windows-7-64bit/

like image 4
user3842110 Avatar answered Sep 28 '22 00:09

user3842110


For Python 3.5 you can do this:

Install a PyCrypto binary from this site : https://github.com/sfbahr/PyCrypto-Wheels

The best way to do it, is:

64bits Python

c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whl pycrypto

32bits Python

c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win32.whl pycrypto

Of course replace c:\Python35\Scripts\pip.exe by your python pip path

To know your python version, run python and look at the architecture displayed between brackets:

C:\Users\utilisateur>python Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

Hope this can help.

like image 3
MordicusEtCubitus Avatar answered Sep 26 '22 00:09

MordicusEtCubitus