I am trying to setup a Jupyter Notebook data analytics project using GraphSense, and I am having pysha3 problems. I use Windows 11, both Python 3.11 and 3.10, the newest Conda version 23.7.2. One of the steps is I need to run the following command to create an environment from a YAML file:
conda env create -f environment.yml
The file can be found under C:GitHubRepo*my_environment* and I changed directory to here.
It starts downloading, extracting packages, successfully preparing, executing, verifying, then there is an "Installing pip dependencies" problem:
Building wheel for pysha3 (setup.py): started
Building wheel for pysha3 (setup.py): finished with status 'error'
Running setup.py clean for pysha3
Successfully built graphsense-python
Failed to build pysha3
Pip subprocess error:
Running command git clone --filter=blob:none --quiet https://github.com/graphsense/graphsense-python 'C:Users*me*AppDataLocalTemppip-req-build-bdcsrhjs'
error: subprocess-exited-with-error
...
C:Users*me*anaconda3envs*my_environment*includepyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\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
ERROR: Could not build wheels for pysha3, which is required to install pyproject.toml-based projects
I noticed, that it tries to open files from my environment for the procedure, so I quit and just tried to install pysha3 with pip install pysha3 under my user directory, first with Python 3.11 which didn’t work, based on other posts I switched to Python 3.10 with Anaconda and ran it in the Anaconda Prompt, and still:
Building wheel for pysha3 (setup.py) ... error
error: subprocess-exited-with-error
python setup.py bdist_wheel did not run successfully.
"C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.31.31103binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPY_WITH_KECCAK=1 -IC:Users*me*anaconda3envspy310include -IC:Users*me*anaconda3envspy310Include "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.31.31103include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /TcModules/_sha3/sha3module.c /Fobuildtemp.win-amd64-cpython-310ReleaseModules/_sha3/sha3module.obj
sha3module.c
C:Users*me*anaconda3envspy310includepyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
Building wheel for pysha3 (setup.py) ... error
error: subprocess-exited-with-error
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x64\cl.exe' failed with exit code 2
So this doesn’t work either, what can I do?
2
Answers
In the end, I got it solved. It was a combination of two problems, that needed to be taken care of at the same time:
-some Visual Studio C++ tools are uninstalled (see: Cannot open include file: 'io.h': No such file or directory)
-Python 3.11 is incapable of building the wheels for pysha3, older version needs to be used (see e.g.: Error while buliding pysha3 with pip? ERROR: Failed building wheel for pysha3)
I first installed the missing tools, then using
pyenv
I installed an older version of Python (see How to install an older version of python, I also recommend installing via Hrvoje's comment) and switched temporarily to Python 3.10 to run the command (based on this: https://stackoverflow.com/a/52133694/19626271), and now it works.Try reinstalling python3.10-dev or python3.11-dev first, and then reinstalling pysha3