'Can't install the pyhash module

I'm trying to install the pyhash module by I keep getting an error. I tried 'pip install pyhash' and 'pip install pyhash==0.9.3' and none worked. The error is:

ERROR: Command errored out with exit status 1:
 command: 'c:\users\perei\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-wv99g0bl\\pyhash\\setup.py'"'"'; __file__='"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-wv99g0bl\\pyhash\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\perei\AppData\Local\Temp\pip-pip-egg-info-sjbip8mh'
     cwd: C:\Users\perei\AppData\Local\Temp\pip-install-wv99g0bl\pyhash\
Complete output (7 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\perei\AppData\Local\Temp\pip-install-wv99g0bl\pyhash\setup.py", line 38, in <module>
    os.path.join(os.environ.get('PYTHON_HOME'), 'include'),
  File "c:\users\perei\appdata\local\programs\python\python38-32\lib\ntpath.py", line 78, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
----------------------------------------
 ERROR: Command errored out with exit status 1: python setup.py egg_info 
 Check the logs for full command output.

The new error message (replaced the old one):

ERROR: Command errored out with exit status 1:
 command: 'c:\users\perei\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-di3e7yi2\\pyhash\\setup.py'"'"'; __file__='"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-di3e7yi2\\pyhash\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\perei\AppData\Local\Temp\pip-pip-egg-info-wazs_edo'
     cwd: C:\Users\perei\AppData\Local\Temp\pip-install-di3e7yi2\pyhash\
Complete output (47 lines):
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\perei\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-wheel-twqluha8\\py-cpuinfo\\setup.py'"'"'; __file__='"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-wheel-twqluha8\\py-cpuinfo\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\perei\AppData\Local\Temp\pip-wheel-km81z24z'
       cwd: C:\Users\perei\AppData\Local\Temp\pip-wheel-twqluha8\py-cpuinfo\
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for py-cpuinfo
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
  File "c:\users\perei\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
    subprocess.check_call(cmd)
  File "c:\users\perei\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\perei\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\perei\\AppData\\Local\\Temp\\tmpkg2kgy4i', '--quiet', 'py-cpuinfo']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:


Solution 1:[1]

You need to install pypy (different implementation of python).

"pyhash only support pypy v6.0 or newer, please download and install the latest pypy."

https://www.pypy.org/download.html

Solution 2:[2]

I was also facing issues installing 'pyhash' using 'pipenv' and pip ('pip install pyhash==0.9.3') on Linux, and I think this might help someone else with the same. I had a different version of 'setuptools' installed in 'pipenv'. To check

pip3 list |grep setuptools

and

pipenv run pip3 list |grep setuptools

In my case, pipenv had the latest setuptools installed. The error I was getting while installing pyhash ("error in pyhash setup command: use_2to3 is invalid.") was because there was a conflict with a version of setuptools. To make pyhash install successfully, I had to downgrade setuptools inside pipenv by

pipenv run python -m pip install 'setuptools~=57.5.0'

and install pyhash (not from Pipfile)

pipenv run python -m pip install 'pyhash==0.9.3'

I hope this works for whoever uses 'pipenv'.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lww
Solution 2