Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install the pyhash module

Tags:

python

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:
like image 666
Evylla Maria Avatar asked Dec 14 '25 07:12

Evylla Maria


2 Answers

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.

like image 119
Czaporka Avatar answered Dec 16 '25 22:12

Czaporka


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

like image 22
eracube Avatar answered Dec 16 '25 22:12

eracube



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!