Failed to build SciPy from source after upgrading to Mac OS Big Sur

This weekend I upgraded my Mac OS to the exciting Big Sur. But after that, I found I failed to install SciPy from pip:

pip3 install scipy

The error message showed that the numpy didn’t support BLAS or LAPACK. So I installed OpenBlas with homebrew:

brew install openblas

Then I built numpy from source following this gist:

pip download --no-binary :all: --no-deps numpy
unzip numpy-*.zip
cd numpy-*

cat > site.cfg <<EOF
[openblas]
libraries = openblas
library_dirs = $(brew --prefix openblas)/lib
include_dirs = $(brew --prefix openblas)/include
runtime_library_dirs = $(brew --prefix openblas)/lib
EOF

pip install .

Then the numpy had the OpenBlas support. However, when I continued to build SciPy from source, it still failed. The error message shows that the new Clang 12 compiler doesn’t recognize some C code in SciPy. I looked through some related issues in https://github.com/scipy/scipy/issues, but failed to find a feasible solution. It seems that we have to wait for SciPy community to solve these problems.