Skip to content
This repository has been 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

Open
mosynaq opened this issue Jan 22, 2017 · 36 comments
Open

Error while attempting to install PyCrypto on Python 3.6 x64 #218

mosynaq opened this issue Jan 22, 2017 · 36 comments

Comments

@mosynaq
Copy link

mosynaq commented Jan 22, 2017

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.

@e00E
Copy link

e00E commented Jan 23, 2017

Same issue as #216 and I can confirm too.

@ghost
Copy link

ghost commented Jan 30, 2017

Same here

@ghost
Copy link

ghost commented Feb 3, 2017

FYI this project is officially dead. You should switch to pycryptodome.

@Kristinita
Copy link

+1

@nueverest
Copy link

@Mrrobot003
Copy link

I have the same error got any ideas to fix?

@wtfiwtz
Copy link

wtfiwtz commented Apr 2, 2018

@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

See saltstack/salt#39614

@lesterpotter
Copy link

lesterpotter commented Apr 6, 2018

For me, the set of commands was:

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

@durgapm
Copy link

durgapm commented 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_amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.14.26428\include\stdint.h"
pip install pycrypto

@teejayen
Copy link

teejayen commented Jul 8, 2018

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

@zmpeterson86
Copy link

None of these proposed fixes works, I still get the same error

@baguniz
Copy link

baguniz commented 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!

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

@windsurfer1122
Copy link

windsurfer1122 commented 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

  1. Install Python
    Checked with Python 3.7 x64 on Windows 10 x64 Version 1803.

    • Get it from the Python homepage
    • 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 (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).

@windsurfer1122
Copy link

Switched to https://www.pycryptodome.org/ with only minor changes.

@OnionKnight
Copy link

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

@khanbalam
Copy link

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

This worked for me as well.

@windsurfer1122
Copy link

As pycrypto is not maintained anymore since 2014, it is recommended to switch to https://www.pycryptodome.org/

@wu0407
Copy link

wu0407 commented Jan 6, 2019

it work for Microsoft Visual Studio 14.0

cd /d "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
vcvarsall amd64
cd \
set CL=-FI"%VCINSTALLDIR%\include\stdint.h"
pip install pycrypto

@windsurfer1122
Copy link

windsurfer1122 commented Jan 6, 2019

As pycrypto is not maintained anymore since 2014, it is recommended to switch to https://www.pycryptodome.org/ or similar like https://cryptography.io/en/latest/

@arisAlexis
Copy link

people are commenting here how to install pycrypto. I did but still getting "PyCrypto not installed" when I run jrnl

@windsurfer1122
Copy link

windsurfer1122 commented Feb 16, 2019

@arisAlexis PyCrypto is no more maintained, please switch to another module like https://www.pycryptodome.org/ or similar like https://cryptography.io/en/latest/
PyCryptodome can also be used as a PyCrypto replacement, please check its homepage

@Sam4829
Copy link

Sam4829 commented Mar 6, 2019

That's how I did it. Extract from my README.md:

Installing on Windows

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).

Worked for me. You are a life saver. Thank you

@adminvulcano
Copy link

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
Copy link

Sam4829 commented 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.

@ghost
Copy link

ghost commented Jun 18, 2019

hello i had the same problem:
_an almost drop-in replacement for the old PyCrypto library. You install it with:

  1. $ pip install pycryptodome ((3.8.2)) or the latest version

go to this directory :
2) [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.
    it works for me, good luck :)

@hsgaurav
Copy link

hsgaurav commented 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
Copy link

jcf9410 commented 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

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

@avrajsri
Copy link

avrajsri commented Oct 3, 2019

pycryto is dead. you can shift to pycryptodome

pip install pycryptodome or cryptography

@Calab
Copy link

Calab commented Oct 16, 2019

pycryto is dead. you can shift to pycryptodome

pip install pycryptodome or cryptography

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
Copy link

Jamim commented 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.

Hello @Calab,
It looks like splunklib is dead as well.

@PhenoBrain
Copy link

Rename Folder"crypto" to "Crypto" in "your_path/../site-packages/crypto", that works for me.

  • python 3.6,9
  • pycrypto 2.6.1

@capitalfear
Copy link

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

  1. Install Python
    Checked with Python 3.7 x64 on Windows 10 x64 Version 1803.

    • Get it from the Python homepage

    • 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 (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).

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
Copy link

phntom commented Feb 4, 2020

@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

See saltstack/salt#39614

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
Copy link

Chamiljun commented Feb 16, 2021

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.
pycrypto

@TacklerGamers
Copy link

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

this worked thanks 👍

@TowerLeon
Copy link

@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

See saltstack/salt#39614

This method works! only need to change 14.13.26128 to your version mentioned in the error log.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests