flier / pyfasthash

Python Non-cryptographic Hash Library
Apache License 2.0
281 stars 52 forks source link

Can't install on Windows? TypeError: expected str, bytes or os.PathLike object, not NoneType #68

Open anentropic opened 1 year ago

anentropic commented 1 year ago

I'm not on Windows myself but I was trying to help someone on Stackoverflow here: https://stackoverflow.com/questions/76827266/how-do-i-install-pyhash

they get:

Collecting pyhash
  Using cached pyhash-0.9.3.tar.gz (602 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\ryanj\AppData\Local\Temp\pip-install-8qp2ra8w\pyhash_91547013240a4880a0295aea028a11c6\setup.py", line 38, in <module>
          os.path.join(os.environ.get('PYTHON_HOME'), 'include'),
        File "C:\Users\ryanj\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 104, in join
          path = os.fspath(path)
      TypeError: expected str, bytes or os.PathLike object, not NoneType
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with 

It looks the same as this earlier issue: https://github.com/flier/pyfasthash/issues/34 (I think that got closed because the reporter ended up manually setting PYTHON_HOME then ran into another compilation problem that got solved. But original issue problem got forgotten.)

There is another instance here: https://github.com/flier/pyfasthash/issues/65#issuecomment-1613977976

I am guessing that the problem may be because pyhash does this: https://github.com/flier/pyfasthash/blob/d4aede268ad79bf65cef46e5f82f43f952403db7/setup.py#L75

But in Python docs the env var is PYTHONHOME without underscore: https://python.readthedocs.io/en/latest/using/cmdline.html#envvar-PYTHONHOME