Unable to build h5py with the latest version of Cython 3.0.4

I am having the same problem as this issue - Cannot build h5py for python 3.11 with HDF5 1.14.11 and I am wanting to build the latest version of h5py with the 3.0.4 version of Cython and I get the same installation errors. I am using python 3.9 . What are my options as I am wanting to build from source since my netCDF4 installation depends on this ?

If I use pip3 install . it runs against the older version of python (3.8) and compiles successfully but that won’t help me at all.

Best regards,

For now, you simply need to use an older version of Cython. If you use a recent version of h5py, it should select a suitable Cython version to build with automatically. See the docs on building h5py from source here:


That sounds like your pip3 command is installed on Python 3.8. However you run Python 3.9, you should be able to use a command like python -m pip - either replace python with a full path to the Python executable you want, or run some activate command first so that python launches Python 3.9. Then this should work to install things for Python 3.9.