Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.
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

Open

Description

@mosynaq

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.

Activity

  1. e00E commented on Jan 23, 2017

    @e00E

    Same issue as #216 and I can confirm too.

  2. Kristinita commented on Feb 17, 2017

    @Kristinita

    +1

  3. Mrrobot003 commented on Apr 2, 2018

    @Mrrobot003

    I have the same error got any ideas to fix?

  4. wtfiwtz commented on Apr 2, 2018

    @wtfiwtz

    @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

  5. lesterpotter commented on Apr 6, 2018

    @lesterpotter

    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
    
  6. durgapm commented on May 9, 2018

    @durgapm

    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

  7. teejayen commented on Jul 8, 2018

    @teejayen

    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
    
  8. zmpeterson86 commented on Jul 10, 2018

    @zmpeterson86

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

  9. baguniz commented on Oct 31, 2018

    @baguniz

    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
  10. windsurfer1122 commented on Nov 9, 2018

    @windsurfer1122

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

  11. windsurfer1122 commented on Nov 20, 2018

    @windsurfer1122
  12. OnionKnight commented on Nov 26, 2018

    @OnionKnight

    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

  13. 6 remaining items

  14. Sam4829 commented on Mar 6, 2019

    @Sam4829

    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

  15. adminvulcano commented on Apr 25, 2019

    @adminvulcano

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

  16. Sam4829 commented on Apr 25, 2019

    @Sam4829

    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.

  17. hsgaurav commented on Jul 5, 2019

    @hsgaurav

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

  18. jcf9410 commented on Jul 24, 2019

    @jcf9410

    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
    
  19. avrajsri commented on Oct 3, 2019

    @avrajsri

    pycryto is dead. you can shift to pycryptodome

    pip install pycryptodome or cryptography

  20. Calab commented on Oct 16, 2019

    @Calab

    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.

  21. Jamim commented on Oct 16, 2019

    @Jamim

    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.

  22. PhenoBrain commented on Oct 22, 2019

    @PhenoBrain

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

    • python 3.6,9
    • pycrypto 2.6.1
  23. capitalfear commented on Jan 15, 2020

    @capitalfear

    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.

  24. phntom commented on Feb 4, 2020

    @phntom

    @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

  25. Chamiljun commented on Feb 16, 2021

    @Chamiljun

    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

  26. TacklerGamers commented on Jun 1, 2021

    @TacklerGamers

    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 👍

  27. TowerLeon commented on Jul 25, 2021

    @TowerLeon

    @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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions