Fails to build from source on MacOS 11 + M1
See original GitHub issue- Operating System: MacOS 11.2
- Python Version: 3.9.1
- h5py version: 3.1.0
- HDF5 version: 1.12.0
Attempting to install h5py
via pip
fails for ARM Macs; there is no prebuilt wheel for this platform, so pip attempts to build h5py from source. However, this fails because it attempts to use Numpy 1.19.3 (when on Python 3.9), but Numpy 1.19.3 does not build on M1 Macs out of the box (build log: h5py_build_fail.log).
If you modify setup.py
so that h5py
builds against Numpy 1.20.1 instead (which works on M1 Macs), h5py builds successfully.
Dumb example patch that fixes the build but isn’t intended to be actually merged:
diff --git a/setup.py b/setup.py
index cc583bc9..9c0400cc 100755
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ NUMPY_MIN_VERSIONS = [
# Numpy Python
('1.14.5', "=='3.7'"),
('1.17.5', "=='3.8'"),
- ('1.19.3', ">='3.9'"),
+ ('1.20.1', ">='3.9'"),
]
# these are required to use h5py
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Build failure on Apple Silicon M1 Mac Mini - Compiler
Hi, I'm seeing a build failure on an Apple Silicon Mac Mini that I'm not seeing on my Intel MacBook Pro. (Both checkouts...
Read more >M1 Mac: Cannot build packages requiring compilation - General
Thankfully I can install package binaries or from source when compilation is not required. But I have tried many things to no real...
Read more >Not Able to Build Some Versions of Python on M1 at 12.3.1
I trying to build older version of python such as 3.6, 3.7, 3.8 using pyenv and having build failures. I am on apple...
Read more >cannot install edgeR on M1 Mac
I am trying to install Rhtslib on macOS Big Sur M1 using R 4.1.0. But I get the following error. And this problem...
Read more >Fixing R Package Installation Errors in MacOS Big Sur ...
install.packages("RcppArmadillo", type = "source"). If you encounter an error like what is shown above, keep going. Step 3. Install a GNU gfortran build...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found an alternative solution:
I have found that pip install only works if you have installed hdf5 separately first on the Mac M1. This was possible through brew but not pip.
Steps: