Can't install h5py
Asked Answered
M

6

8

I am trying to h5py on Windows10 64bit, Python 3.8.5, Pip 20.2.4.

Used this command

pip install h5py

But this throws an error

ERROR: Could not build wheels for h5py which use PEP 517 and cannot be installed directly

Looks like it's quite known issue for pep 517 and other packages, so i try to check all of the solutions like

pip install --no-use-pep517 h5py
pip install --no-binary h5py

But nothing works. How can I install h5py?

Mccrary answered 3/11, 2020 at 13:33 Comment(0)
M
3

Found a solution - I was trying to install on Python3.8.5 32bit. Switching to 64bit just solved the issue.

I saw that the latest version doesn't support win 32, check this: github.com/h5py/h5py/issues/1753

Mccrary answered 3/11, 2020 at 14:20 Comment(3)
I had no problem with using 64bit, so just switched to it. I saw that latest version doesn't support win 32, check this : github.com/h5py/h5py/issues/1753 @AlirezaEsrariMccrary
Would you mind adding this last comment to your answer? It's relevant information (external sources confirming why your answer works, at least in your case) and comments may be lost in the future.Prefix
Here is the solution, you can find it. I have given a detail solution. https://mcmap.net/q/1323090/-cannot-install-h5pyWafd
G
10

Installing versioned-hdf5 will solve this issue.

pip install versioned-hdf5

Now do pip install h5py

Graphitize answered 9/12, 2020 at 15:55 Comment(1)
Here is the solution, you can find it. I have given a detail solution. https://mcmap.net/q/1323090/-cannot-install-h5pyWafd
O
6

I'm not sure if you're getting any other kind of dependencies errors besides this. In my case, I had additional details about the missing dependency libhdf5.so. It stated: "error: libhdf5.so cannot open shared object file: No such file or directory".

I checked the h5py documentation to make sure I had the right versions of pip and setuptools, https://pip.pypa.io/en/stable/reference/pip/.

pip install --upgrade pip setuptools wheel

I installed the libhdf5.so library by running below code and that solved it for me:

sudo apt-get install libhdf5-dev

I've come across similar PEP 517 errors caused by missing dependencies:

  1. ERROR: Could not build wheels for glpk which use PEP 517 and cannot be installed directly
  2. ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly

PEP 517 error

Olivier answered 17/11, 2020 at 14:11 Comment(0)
M
3

Found a solution - I was trying to install on Python3.8.5 32bit. Switching to 64bit just solved the issue.

I saw that the latest version doesn't support win 32, check this: github.com/h5py/h5py/issues/1753

Mccrary answered 3/11, 2020 at 14:20 Comment(3)
I had no problem with using 64bit, so just switched to it. I saw that latest version doesn't support win 32, check this : github.com/h5py/h5py/issues/1753 @AlirezaEsrariMccrary
Would you mind adding this last comment to your answer? It's relevant information (external sources confirming why your answer works, at least in your case) and comments may be lost in the future.Prefix
Here is the solution, you can find it. I have given a detail solution. https://mcmap.net/q/1323090/-cannot-install-h5pyWafd
S
1

Use specific version of h5py for example you can use command:

pip install h5py==2.9.0
Sarraceniaceous answered 11/10, 2021 at 7:9 Comment(2)
This did not solve problem for Mac M1Premundane
first enter this command: pip install versioned-hdf5 then try pip install h5py==2.9.0Sarraceniaceous
M
0

For windows use pip install versioned-hdf5. This will work Then you can also install Keras easily.

Montes answered 9/3, 2021 at 8:52 Comment(0)
H
0

I ran into the same problem while trying to install qiskit, which also (needed smth which needed smth which...) needed h5py. I got the same error message, but none of the answers here worked.

The first found workaround for me was installing h5py from https://www.lfd.uci.edu/~gohlke/pythonlibs/#h5py , which, although seems being quite on-own-risk, is also specified in https://docs.h5py.org/en/stable/build.html#wheels .

I used python 3.8 on Win7, 32 bit. For my purposes, installing h5py 3.4 did not work, but installing 2.1 did (I think the concrete package just needed 2.1 and ignored 3.4).

Commands used:

pip install <full path to downloaded .whl file, can be copied from file properties>

pip install <wanted package, for me quiskit, for example>
Homogenous answered 9/10, 2021 at 13:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.