Skip to main content
Luca Corbucci

How to install hdf5 on M1 Mac

·1 min

I’ve spent part of this afternoon trying to install Tensorflow on my M1 Mac. I tried to install it writing “tensorflow” in the requirements.txt file but it didn’t work and I always had the following error:

ERROR: Could not find a version that satisfies the requirement TensorFlow (from versions: none)

Then I’ve found out that I needed to use a different tensorflow version so I’ve put “tensorflow-macos” and “tensorflow-metal” in the requirements.txt file.

Unfortunately, I had another error, this time related to “hdf5”:

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

In the end, I was able to solve this error with the following commands:

brew install hdf5
pyenv exec pip install --no-binary=h5py h5py

Then I finally installed “tensorflow-macos” and “tensorflow-metal”.

Note tha sometimes it is possibile to do the same thing with other packages (for example I’ve tried with box2d-py).