Installing h5py on Windows 10 fails


I am getting an error running the command “pip install h5py” in Windows 10
The error looks like this:

Building wheels for collected packages: h5py
  Building wheel for h5py (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files (x86)\python37-32\python.exe' 'c:\program files (x86)\python37-32\lib\site-packages\pip\_vendor\pep517\in_process\' build_wheel 'C:\Users\pknight\AppData\Local\Temp\tmp_rf3a1be'
       cwd: C:\Users\pknight\AppData\Local\Temp\pip-install-_o_j_d77\h5py_fe99a75be5de4d8fade812ed630fb391
  Complete output (71 lines):
  running build_ext
  Loading library to get build settings and version: hdf5.dll
  error: Unable to load dependency HDF5, make sure HDF5 is installed properly
  error: [WinError 126] The specified module could not be found
  ERROR: Failed building wheel for h5py
Failed to build h5py
ERROR: Could not build wheels for h5py, which is required to install pyproject.toml-based projects

I have searched the web but can not find an answer to the issue.



It looks like you have a 32-bit build of Python (paths containing python37-32). h5py now only provides pre-built packages for 64-bit Python. If it’s practical, I’d suggest installing 64-bit Python instead; there’s not much reason to run the 32-bit version nowadays.

If you do need 32-bit Python for any reason, there are 32-bit wheels you can download on Christoph Gohlke’s page.