Search code examples
pip

Error while buliding pysha3 with pip? ERROR: Failed building wheel for pysha3


when I try to install with pip install pysha3, I get the error "ERROR: Failed building wheel for pysha3". I did already install the Windows build tools. I can't find much help on Google unfortunately. I am on Windows 11.

Here is the log

`

PS C:\Users\Alexis> pip3 install pysha3
Collecting pysha3
  Using cached pysha3-1.0.2.tar.gz (829 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pysha3
  Building wheel for pysha3 (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      copying sha3.py -> build\lib.win-amd64-cpython-311
      running build_ext
      building '_pysha3' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\Modules
      creating build\temp.win-amd64-cpython-311\Release\Modules\_sha3
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPY_WITH_KECCAK=1 -IC:\Python311\include -IC:\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcModules/_sha3/sha3module.c /Fobuild\temp.win-amd64-cpython-311\Release\Modules/_sha3/sha3module.obj
      sha3module.c
      C:\Users\Alexis\AppData\Local\Temp\pip-install-78ji94vk\pysha3_9e9c90f2f01445aeb1ab3ed6a6c14e42\Modules\_sha3\backport.inc(78): fatal error C1083: Cannot open include file: 'pystrhex.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pysha3
  Running setup.py clean for pysha3
Failed to build pysha3
Installing collected packages: pysha3
  Running setup.py install for pysha3 ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pysha3 did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running install
      C:\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      copying sha3.py -> build\lib.win-amd64-cpython-311
      running build_ext
      building '_pysha3' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\Modules
      creating build\temp.win-amd64-cpython-311\Release\Modules\_sha3
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPY_WITH_KECCAK=1 -IC:\Python311\include -IC:\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcModules/_sha3/sha3module.c /Fobuild\temp.win-amd64-cpython-311\Release\Modules/_sha3/sha3module.obj
      sha3module.c
      C:\Users\Alexis\AppData\Local\Temp\pip-install-78ji94vk\pysha3_9e9c90f2f01445aeb1ab3ed6a6c14e42\Modules\_sha3\backport.inc(78): fatal error C1083: Cannot open include file: 'pystrhex.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pysha3

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

`

I did install the Windows Build tools for c++


Solution

  • Having this same issue, last time I resolved it by back-switching to Python 3.8.7 perhaps. But now I installed 3.11 and now again pysha3 is not installing. (Window 10)

    enter image description here