How in the world do I get around this? I've tried using pip, which gives the same result. I found a prebuilt PyCrypto 2.3 binary and installed that, but it's nowhere to be found on the system (not working).
If you don't already have a C/C++ development environment installed that is compatible with the Visual Studio binaries distributed by Python.org, then you should stick to installing only pure Python packages or packages for which a Windows binary is available.
After years and years, python finally agreed for a binary disribution called wheel which allows to install even binary extensions on Windows without having a compiler with simple pip install packagename. There is a list of popular packages with their status. Pycrypto is not there yet, but lxml, PySide and Scrapy for example.
Edited Nov 2015: pip uninstall pycrypto & pip install pycryptodome. It is a pycrypto fork with new features and it supports wheel. It replaces pycrypto, so existing code will continue to work (see )
Microsoft has recently recently released a standalone, dedicated Microsoft Visual C++ Compiler for Python 2.7. If you're using Python 2.7, simply install that compiler and Setuptools 6.0 or later, and most packages with C extensions will now compile readily.
vcvarsall.bat is part of the Visual C++ compiler, you need that to install what you are trying to install. Don't even try to deal with MingGW if your Python was compiled with Visual Studio toolchain and vice versa. Even the version of the Microsoft tool chain is important. Python compiled with VS 2008 won't work with extensions compiled with VS 2010!
As far as I know the following is still true. This was posted in the link above in June, 2010 referring to trying to build extensions with VS 2010 Express against the Python installers available on python.org.
If you do this, you must also re-build Python with Visual Studio 2010 Express. You cannot use the standard Python binary installer for Windows. Nor can you use any C/C++ extensions built with a different compiler than Visual Studio 2010 (Express).
If you are on Windows and struggling with installing Pycrypcto just use the:pip install pycryptodome.It works like a miracle and it will make your life much easier than trying to do a lot of configurations and tweaks.
It's possible to build PyCrypto using the Windows 7 SDK toolkits. There are two versions of the Windows 7 SDK. The original version (for .Net 3.5) includes the VS 2008 command-line compilers. Both 32- and 64-bit compilers can be installed.
This should allow "python setup.py install" to succeed assuming there are no other issues with the C code. But I vaaguely remember that I had to edit a couple of PyCrypto files to enable mpir and to find the mpir libraries but I don't have my Windows system up at the moment. It will be a couple of days before I'll have time to recreate the steps. If you haven't reported success by then, I'll post the PyCrypto steps. The steps will assume you were able to compile mpir.
Install setuptools (setuptools 6.0 or later is required for Python to automatically detect this compiler package)either by: pip install setuptoolsor download "Setuptools bootstrapping installer" source from, save this file somwhere on your filestystem as "ez_python.py" and install with: python ez_python.py
Open Windows elevated Command Prompt cmd.exe (with "Run as administrator") to install "Microsoft Visual C++ Compiler for Python 2.7" for all users. You can use following command to do so: msiexec /i C:\users\jozko\download\VCForPython27.msi ALLUSERS=1 just use your own path to file: msiexec /i ALLUSERS=1
My answer might not be related to problem mention here, but I had same problem with Python 3.4 where Crypto.Cipher wasn't a valid import. So I tried installing PyCrypto and went into problems.
Step 2: Remove all the Microsoft Visual C++ 2010 Redistributable packages from Control Panel\Programs and Features. If you don't do those then the install is going to fail with an obscure "Fatal error during installation" error.
Note: If you don't have "Microsoft Visual C++ Compiler for Python 2.7" installed then it will prompt for installation, once installation finished try the above steps it should work fine.
One must avoid having both PyCrypto and PyCryptodome installedat the same time, as they will interfere with each other.This option is therefore recommended only when you are sure thatthe whole application is deployed in a virtualenv.
If you want to install under the Crypto package, replacebelow pycryptodomex with pycryptodome. That being the case and if you want to run the test, instead of Cryptodome.SelfTest, run Crypto.SelfTest.
Windows does not come with a C compiler like most Unix systems.The simplest way to compile the PyCryptodome extensions fromsource code is to install the minimum set of Visual Studiocomponents freely made available by Microsoft.
However this did not solve the problem in my case. What did the trick was installing cryoSPARC as root (sudo).
Strangely, that was not necessary when I installed it on another Ubuntu machine.
how do i find and install Pycrypto 2.6 to python 3.2 in Ubuntu 12.04, i have looked everywhere for a package, i managed to get it installed on python 2.7 just fine, but i want be able to use the lib in 3.2. Program in both and want to be able to use it in both, thank you.
The client_secrets.json file is correctly present in maima folder. Searching in Stackoverflow I found the explanation for thi issue in this link: -account-and-pydrive , which says: "After some more research it seems like I needed to install pycrypto to fix the import error described above. I don't know why as it is not specified in the error message."
You either need to install the splunk-sdk using easy_install or pip OR make sure you have PYTHONPATH variable defined pointing to the sdk folder you just cloned. More details on how to install are available at -CAAAEDG.
Some environments, most notably Google App Engine, do not allow the installationof Python packages that require compilation of C extensions and thereforecannot install cryptography. If you can install cryptography, youshould disregard this section.
Once you have installed pycrypto and ecdcsa, you can tell PyJWT to usethe legacy implementations with jwt.register_algorithm(). The followingexample code shows how to configure PyJWT to use the legacy implementationsfor RSA with SHA256 and EC with SHA256 signatures.
Just a note on this bug:
Seems like some cheap hosts (in my case Site5), has /tmp mounted with noexec. I of course don't have any permissions to change this. So a way to install to a different directory, or simply execute the script elsewhere would be great.
For Mac: Under Snow Leopard, there are several python programs installed but it makes sense to run the latest which is Python 2.6. Unfortunately, if you try to install Python and Pycrytpo, you might get an error message something like this:
Great helps on getting the Python scripts to work on my 10.5.6 Mac. The Xcode packages for the 10.5.6 OS x are known as the SDK 10.3.6 Xcode files and are in the Optional installations section of the startup disk.
Jane.. thanks very much. I have redownloaded the Pycrypto file 2.1 (NOT 2.0.1) and keep running smack into the same GMP errors when attempting to the build process. Despite the GMP error and appearance that the build script is exiting, there is an egg file where you say it should be. Seems awfully odd that it is there, despite to build and install script not running properly.
I have been using python 2.6, pycrypto 2.l, indeptepub.decrypter v.2 on XP with no problem until today. All of a sudden I am told when I go to put the output file name in that there is no file or path. I uninstalled and reinstalled everything and still get the same message. I want to decrypt e.pubs from Adobe Digital Editions. Any help you can give me?
I had a problem installing with Xcode 4 on Lion 10.7.1, GMP not found error, had to remove other python versions and install this one : Python 2.7.2 Mac OS X 64-bit/32-bit x86-64/i386 Installer with pycrypto version 2.3. and this worked for me.
The following occurred on a Windows 7 x64 Professional machine. Just installed python 3.4 which automatically installed "easy_install". pySNMP was the first item I tried to install. Is this a problem with pycrypto?? Why would I need vcvarsall.bat (ms visual studio, right?)?
C:\Installs\python>easy_install pysnmp-4.2.5-py3.4.egg
Processing pysnmp-4.2.5-py3.4.egg
Copying pysnmp-4.2.5-py3.4.egg to c:\python34\lib\site-packages
Adding pysnmp 4.2.5 to easy-install.pth file
Installing libsmi2pysnmp script to C:\Python34\Scripts
Installing build-pysnmp-mib script to C:\Python34\Scripts
We strongly recommend using pip to install Fabric as it is newer andgenerally better than easy_install. However, a combination of bugs inspecific versions of Python, pip and PyCrypto can prevent installation ofPyCrypto. Specifically:
For an up-to-date list of exact testing/development requirements, includingversion numbers, please see the requirements.txt file included with thesource distribution. This file is intended to be used with pip, e.g. pipinstall -r requirements.txt.
Look at the output of "pacman -Si python-pycryptodome". It states that it provides "python-crypto". You should remove python-crypto and keep python-pycryptodome if you need the additional functionality of python-pycryptodome. If you only need the functionality of python-crypto. pick either one and remove the other.
If the setup.py script crashes with a DistutilsPlatformError complainingthat the file /usr/lib/python2.2/config/Makefile doesn't exist, thismeans that the files needed for compiling new Python modules aren'tinstalled on your system. Red Hat users often run into this because theydon't have the python2-devel RPM installed. The fix is to simply installthe requisite RPM. On Debian/Ubuntu, you need the python-dev package.
df19127ead