title: How to install h5py (needed for Keras) on MacOS with M1?
body: <p>I have an M1 MacBook. I have installed python 3.9.1 using pyenv, and have pip3 version 21.0.1.
  I have installed homebrew and hdf5 1.12.0_1 via <code>brew install hdf5</code>.</p>
  <p>When I type</p>
  <pre><code>pip3 install h5py
  </code></pre>
  <p>I get the error:</p>
  <pre><code>Requirement already satisfied: numpy&gt;=1.19.3 in /Users/.../.pyenv/versions/3.9.1/lib/python3.9/site-packages (from h5py) (1.20.0)
  Building wheels for collected packages: h5py
    Building wheel for h5py (PEP 517) ... error
  
    Loading library to get build settings and version: libhdf5.dylib
    error: Unable to load dependency HDF5, make sure HDF5 is installed properly
    error: dlopen(libhdf5.dylib, 6): image not found
    ----------------------------------------
    ERROR: Failed building wheel for h5py
  </code></pre>
  <p>I saw that <code>libhdf5.dylib</code> is present in <code>/opt/homebrew/opt/hdf5/lib</code>, so I tried <code>export LDFLAGS=&quot;-L/opt/homebrew/opt/hdf5/lib&quot;</code> and <code>export CPPFLAGS=&quot;-L/opt/homebrew/opt/hdf5/include&quot;</code> beforehand but they don't help.</p>
  <p>How can I install h5py?</p>
  <p>I am actually installing h5py as a requirement to install Keras.</p>
  <p>Thanks!</p>