You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 27, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 27, 2022. It is now read-only.
Error while attempting to install PyCrypto on Python 3.6 x64 #218
I am trying to install PyCrypto on Python 36 x64 on windows 10. After issuing the command pip install pycrypto, I receive the following: the error is here. I have Visual Studio 2015 with Update 3 installed.
Reacted by Саша “Nelie” Черных, jakirkham, Elijas Dapšauskas, nueverest, jdell64, Serge Mosin, Sourav Singha, Petr Vecera, Leofis G, wwj718 and 14 more
@Mrrobot003 I needed to do this (after installing MS VS Community Edition):
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.13.26128\include\stdint.h"
pip install pycrypto
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.13.26128\include\stdint.h"
pip install pycrypto
Reacted by Elijas Dapšauskas, deepeetoo, GuillaumeOrlando, Bjoern_B, DaDi, MIlkhail Antonov, Li-Qing Wang, xmcp, Tshunglee Tan, Yash Chhabria and 4 more
for Python 3.6 32 bit following set of commands worked:
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build" vcvarsall.bat x86_amd64 cd \ set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.14.26428\include\stdint.h" pip install pycrypto
Reacted by jakobvalic, Falcon1918, Jeff Green, Sweet, Nimrod Maina, Royalone94, Hector Munoz and b
Reacted by Elijas Dapšauskas, Gabriel Tanase, GuillaumeOrlando, Daigan1 and Jian Cao
Looks like Visual Studio Build Tools have been updated to 14.14.26428. The following worked for me:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.14.26428\include\stdint.h"
pip install pycrypto
I'm also get the same error. An error occurred because of a different version from the script. So, i've created a script that is less sensitive to build tool version. It works well. Thanks!
cd"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
vcvarsall.bat x86_amd64
cd%VCINSTALLDIR%for /R %f in (*stdint.h) do set CL=-FI"%f"
pip install pycrypto
Reacted by Laurent Clévy, Antonio Mendoza, Timothy Cyrus, takeabreath, Corey Neskey, shreekantsh, Khizar Hussain, Chamiljun, mytsx, Aguará guazú and 2 more
Reacted by takeabreath, Cristian Rojas, Kirill Borunov, Claire McNamara, Khizar Hussain, Alexandru Dima, Edward Barbera and ilexaquifolium
pycrypto has to compile some code due to legal restrictions on cryptography, so this is why the VC++ Build Tools had to be installed and the VS Developer Command Prompt had to be started.
There's a small issue with the pycrypto source, so as a workaround we have to include the correct header by setting the environment variable CL.
set CL=-FI"%VCToolsInstallDir%\include\stdint.h"
pip install pycrypto
Exit VS Developer Command Prompt: exit
The Visual C++ Build Tools may be deinstalled now, but it's recommended to keep them installed to be able to upgrade pycrypto when necessary.
To install other modules just a normal but elevated(!!!) Command Prompt is needed (Run As Admin via Right Click).
Reacted by Sagnik, Gregory Bown, Star zhou, Narendra Varma P, ebriseid, the_AWPerator, Aditya Kresna, Radek, Tom L Kaufmann, AshGaur and 5 more
Reacted by Elijas Dapšauskas, Dheeraj Remanan, Anthony J. Bufort, gaojin and Aditya Kresna
Reacted by Sagnik, Gregory Bown, Narendra Varma P, the_AWPerator and Aditya Kresna
1. Install Python
Checked with Python 3.7 x64 on Windows 10 x64 Version 1803.
* Get it from the [Python homepage](https://www.python.org/)
* Install launcher for all users
* Add Python to PATH
Adds %ProgramFiles%\Python37 + \Scripts to PATH
* **Use Customize Installation (!!! necessary for advanced options !!!)**
* Advanced Options
* Install for all users
2. Install Visual C++ Build Tools
Checked with Visual Studio 2017.
* Get the Build Tools from the [Visual Studio download page](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017) (link as of 2018-11)
* Install Visual C++ Build Tools with additional standard components
* Windows 10 SDK
* Visual C++ Tools for CMake
* Core Tools for Testing
3. Install necessary Python modules
* Start an elevated(!!!) VS Developer Command Prompt (Run As Admin via Right Click)
* Update PIP first: `python -m pip install --upgrade pip`
* Install pycrypto module
pycrypto has to compile some code due to legal restrictions on cryptography, so this is why the VC++ Build Tools had to be installed and the VS Developer Command Prompt had to be started.
There's a small issue with the pycrypto source, so as a workaround we have to include the correct header by setting the environment variable CL.
`set CL=-FI"%VCToolsInstallDir%\include\stdint.h"`
`pip install pycrypto`
* Exit VS Developer Command Prompt: `exit`
The Visual C++ Build Tools may be deinstalled now, but it's recommended to keep them installed to be able to upgrade pycrypto when necessary.
To install other modules just a normal but elevated(!!!) Command Prompt is needed (Run As Admin via Right Click).
I am not really familiar with mac environment but i would recommend to shift to PyCryptodome if that is possible for you as support for pyCrypto has ended. Answering your question if you can solve error while installing PyCrypto : You have to look for the issue that is preventing it from installing. If you can provide what is actually going wrong during installation it may be possible to reach a solution.
@Isaac-Frost thank you so much this is what worked for me everyone said to install pycrypto but the correct way for the problem #218 is your answer that is to change the lower case letter to upper case letter.
This worked for me, but I needed to replace the XXXX with my current version of VS, which was 14.16.27023
Looks like Visual Studio Build Tools have been updated to 14.14.26428. The following worked for me:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\XXXX\include\stdint.h"
pip install pycrypto
Install pycrypto module
pycrypto has to compile some code due to legal restrictions on cryptography, so this is why the VC++ Build Tools had to be installed and the VS Developer Command Prompt had to be started.
There's a small issue with the pycrypto source, so as a workaround we have to include the correct header by setting the environment variable CL. set CL=-FI"%VCToolsInstallDir%\include\stdint.h" pip install pycrypto
Exit VS Developer Command Prompt: exit
The Visual C++ Build Tools may be deinstalled now, but it's recommended to keep them installed to be able to upgrade pycrypto when necessary.
To install other modules just a normal but elevated(!!!) Command Prompt is needed (Run As Admin via Right Click).
first of all, you're a wizard. So jot that down. I've been fighting this problem for three days. I know what it is now, when you click "install for all users" there's an aditional dep that's added along with it (you check one box, so python installs the other. I think it's pre-compile some setup.py thing) anyways. You're the real MVP. If you have problems with your wife/husband, boss, anyone, just let em know you're legit a god. reference me if necessary. Thanks man. You've helped my project out in a huge way.
@Mrrobot003 I needed to do this (after installing MS VS Community Edition):
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.13.26128\include\stdint.h"
pip install pycrypto
I'm also get the same error. An error occurred because of a different version from the script. So, i've created a script that is less sensitive to build tool version. It works well. Thanks!
cd"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
vcvarsall.bat x86_amd64
cd%VCINSTALLDIR%for /R %f in (*stdint.h) do set CL=-FI"%f"
pip install pycrypto
Thx a lot. I had try many solution but this one work for me.
I'm also get the same error. An error occurred because of a different version from the script. So, i've created a script that is less sensitive to build tool version. It works well. Thanks!
cd"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
vcvarsall.bat x86_amd64
cd%VCINSTALLDIR%for /R %f in (*stdint.h) do set CL=-FI"%f"
pip install pycrypto
@Mrrobot003 I needed to do this (after installing MS VS Community Edition):
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.13.26128\include\stdint.h"
pip install pycrypto
Activity
e00E commentedon Jan 23, 2017
Same issue as #216 and I can confirm too.
Kristinita commentedon Feb 17, 2017
+1
nueverest commentedon May 28, 2017
Related stackoverflow post: https://stackoverflow.com/questions/41843266/microsoft-windows-python-3-6-pycrypto-installation-error
Mrrobot003 commentedon Apr 2, 2018
I have the same error got any ideas to fix?
wtfiwtz commentedon Apr 2, 2018
@Mrrobot003 I needed to do this (after installing MS VS Community Edition):
See saltstack/salt#39614
lesterpotter commentedon Apr 6, 2018
For me, the set of commands was:
durgapm commentedon May 9, 2018
for Python 3.6 32 bit following set of commands worked:
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"vcvarsall.bat x86_amd64cd \set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.14.26428\include\stdint.h"pip install pycryptoteejayen commentedon Jul 8, 2018
Looks like Visual Studio Build Tools have been updated to 14.14.26428. The following worked for me:
zmpeterson86 commentedon Jul 10, 2018
None of these proposed fixes works, I still get the same error
baguniz commentedon Oct 31, 2018
I'm also get the same error. An error occurred because of a different version from the script. So, i've created a script that is less sensitive to build tool version. It works well. Thanks!
windsurfer1122 commentedon Nov 9, 2018
ATTENTION!!! As pycrypto is not maintained anymore, please switch to pycryptodome.
That's how I did it. Extract from my README.md:
Installing on Windows
Install Python
Checked with Python 3.7 x64 on Windows 10 x64 Version 1803.
Adds %ProgramFiles%\Python37 + \Scripts to PATH
Install Visual C++ Build Tools
Checked with Visual Studio 2017.
Install necessary Python modules
python -m pip install --upgrade pippycrypto has to compile some code due to legal restrictions on cryptography, so this is why the VC++ Build Tools had to be installed and the VS Developer Command Prompt had to be started.
There's a small issue with the pycrypto source, so as a workaround we have to include the correct header by setting the environment variable CL.
set CL=-FI"%VCToolsInstallDir%\include\stdint.h"pip install pycryptoexitThe Visual C++ Build Tools may be deinstalled now, but it's recommended to keep them installed to be able to upgrade pycrypto when necessary.
To install other modules just a normal but elevated(!!!) Command Prompt is needed (Run As Admin via Right Click).
windsurfer1122 commentedon Nov 20, 2018
Switched to https://www.pycryptodome.org/ with only minor changes.
OnionKnight commentedon Nov 26, 2018
set CL=-FI"%VCINSTALLDIR%\include\stdint.h"
pip3 install pycrypto.
I had Visual Studio 14, so I just found my vcvarsall.bat and used my path to stdint.h
Worked. Thanks for the help
6 remaining items
Sam4829 commentedon Mar 6, 2019
Worked for me. You are a life saver. Thank you
adminvulcano commentedon Apr 25, 2019
Is there any way I can do this on Mac?
It's not working as well here, but I can't use the tools you are using...
Sam4829 commentedon Apr 25, 2019
I am not really familiar with mac environment but i would recommend to shift to PyCryptodome if that is possible for you as support for pyCrypto has ended.
Answering your question if you can solve error while installing PyCrypto : You have to look for the issue that is preventing it from installing. If you can provide what is actually going wrong during installation it may be possible to reach a solution.
hsgaurav commentedon Jul 5, 2019
@Isaac-Frost thank you so much this is what worked for me everyone said to install pycrypto but the correct way for the problem #218 is your answer that is to change the lower case letter to upper case letter.
[C:\Users\s****\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\crypto]
here try to change the file name crypto to Crypto with upper case C because they import it as Crypto in every package.
jcf9410 commentedon Jul 24, 2019
This worked for me, but I needed to replace the XXXX with my current version of VS, which was 14.16.27023
avrajsri commentedon Oct 3, 2019
pycryto is dead. you can shift to pycryptodome
pip install pycryptodome or cryptography
Calab commentedon Oct 16, 2019
So, what do you do if another module that you are trying to install need pycrypto? In my case I'm trying to install splunklib.
Jamim commentedon Oct 16, 2019
Hello @Calab,
It looks like splunklib is dead as well.
PhenoBrain commentedon Oct 22, 2019
Rename Folder
"crypto" to "Crypto"in "your_path/../site-packages/crypto", that works for me.capitalfear commentedon Jan 15, 2020
first of all, you're a wizard. So jot that down. I've been fighting this problem for three days. I know what it is now, when you click "install for all users" there's an aditional dep that's added along with it (you check one box, so python installs the other. I think it's pre-compile some setup.py thing) anyways. You're the real MVP. If you have problems with your wife/husband, boss, anyone, just let em know you're legit a god. reference me if necessary. Thanks man. You've helped my project out in a huge way.
phntom commentedon Feb 4, 2020
Worked like a charm! Amazing!
In Visual Studio 14 2019:
Follow install instructions here:
https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.2_standalone:_Build_Tools_for_Visual_Studio_2019_.28x86.2C_x64.2C_ARM.2C_ARM64.29
Activate your venv (venv\scripts\activate)
then:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
set CL=-FI"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include\stdint.h"
pip install pycrypto
Chamiljun commentedon Feb 16, 2021
Thx a lot. I had try many solution but this one work for me.

TacklerGamers commentedon Jun 1, 2021
this worked thanks 👍
TowerLeon commentedon Jul 25, 2021
This method works! only need to change 14.13.26128 to your version mentioned in the error log.