2

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:

3 Answers3

2

First error message

The output looks like the installation is failing because the setup script expects the PYTHON_HOME environment variable to be set but it isn't.

Try executing this in your shell before rerunning the pip install command (in the same shell):
set PYTHON_HOME=c:\users\perei\appdata\local\programs\python\python38-32

Alternative: set PYTHON_HOME permanently:

  1. open the Start menu and start typing "env"..., then click on "Edit the system environment variables (Control Panel)"
  2. click New... under "User variables for <user>"
  3. under Variable name put "PYTHON_HOME"
  4. under Variable value put the path to Python installation directory, in your case "c:\users\perei\appdata\local\programs\python\python38-32"
  5. open a new instance of cmd.exe and retry the pip install command

Second error message

The script fails while trying to build a wheel: error: invalid command 'bdist_wheel'. Before failing it actually warns that The wheel package is not available.. You just need to do pip install wheel.

Czaporka
  • 2,190
  • 3
  • 10
  • 23
  • None of them worked, it gave me another error: ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. – Evylla Maria Nov 10 '20 at 00:30
  • Is there also a stack trace above the new error message? Can you add it to the question? – Czaporka Nov 10 '20 at 00:38
  • @EvyllaMaria note how the piece of stack trace you added starts with `The above exception was the direct cause of the following exception:` - if possible, please also add the part above it, it's probably the most important one. – Czaporka Nov 10 '20 at 00:49
  • @EvyllaMaria okay looks like you just need to `pip install wheel` – Czaporka Nov 10 '20 at 01:03
  • 2
    I had to install the Microsoft C++ build tools, but it worked now. Thank you, I appreciate your patience. – Evylla Maria Nov 10 '20 at 01:20
1

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

eracube
  • 2,484
  • 2
  • 15
  • 18
0

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

lww
  • 624
  • 1
  • 7
  • 14
  • 1
    pyhash works with CPython. I suspect the authors meant to say that if a pypy implementation is used then v6.0 or newer is required. – savac May 06 '21 at 11:46