macOS M1 Pro install h5py

installation TensorFlow Time,encounter a dependency h5py,This package could not be successfully installed anyway,Error no information available:

it's hard to do,Check the log and find that there is no binary package for m1,compiled automatically。But the compiler reported that the header file could not be found:

So use brew to install the missing library,under search,Really have: brew install hdf5 ,Execute again after installation h5py installation,Still the same error,Obviously still can't find it。

use the command find /opt -iname "*hdf5.h*" Find,should be able to find /opt/homebrew/include/hdf5.h this path,Add the relevant environment variables using the following command:

Execute the command again to install h5py: python3 -m pip install h5py

Finally installed successfully。

Original article written by Gerber drop-off:R0uter's Blog » macOS M1 Pro install h5py

Reproduced Please keep the source and description link:

About the Author


The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。


  1. Sorry I fixed this problem but now my issue is no more this error message. Now when I type the command find /opt -iname “*hdf5.h*”
    I don’t have anything in return on my terminal. Just a new (base)MacBook-Pro….line to enter a new command

  2. hi,
    thanks for your help. I managed to install hdf5 with hombres but when I try running the command Find /opt -iname “*hdf5.h*”
    I get this message find: /opt/cisco/anyconnect/temp/downloader: Permission denied
    I don’t understand. I try doing it from other internet connection, and doing it while deactivating the Cisco VPN (also I don’t have Cisco app) but nothing seems to work.

    Do you have any suggestion ?

    Thank you

  3. Iam getting this error after executing the cammand :

    Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
    To rerun under ARM use:
    arch -arm64 brew install …
    To install under x86_64, install Homebrew into /usr/local.

    Upon trying the command again:
    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

    1. make sure ur terminal running on arm mode instead of Rosetta. And delete the Homebrew thing under /usr/local, arm version of brew installed at /opt/homebrew

      I think u need to clean out your env path settings, the intel env confusing them.

  4. I did as you instructed but, still get:

    ERROR: Could not build wheels for h5py, which is required to install pyproject.toml-based projects

    The above error is generated after running this command for the second time: python3 -m pip install h5py

    1. Did you try find /opt -iname "*hdf5.h*"
      see if there any results like /opt/homebrew/include/hdf5.h
      the main theory is h5py requiring hdf5, but it cant build itself, we have to install the library manually, then install h5py.

Leave a Reply

Your email address will not be published. Required fields are marked *