How to install SciPy on Apple Silicon (ARM / M1)

I have successfully installed python 3.9.1 with Numpy and Matplotlib on a new Mac mini with Apple Silicon. However, I cannot install SciPy : I get compilation errors when using

python3 -m pip install scipy

I also tried installing everything from brew, and import scipy works, but using it gives a seg fault. I have installed ARM versions of lapack and openblas, but this does not fix the problem.

Has anyone succeeded? (I am interested in running it natively, not through Rosetta).


It's possible to install on regular arm64 brew python, you need to compile it yourself.

If numpy is already installed (from wheels) you'll need to uninstall it:

pip3 uninstall -y numpy pythran

I had to compile numpy, which requires cython and pybind11:

pip3 install cython pybind11

Then numpy can be compiled:

pip3 install --no-binary :all: --no-use-pep517 numpy

Scipy needs pythran (this should happen after installing numpy):

pip3 install pythran

Then we need to compile scipy itself, it depends on fortran and BLAS/LACK:

brew install openblas gfortran

Tell scipy where it can find this library:

export OPENBLAS=/opt/homebrew/opt/openblas/lib/

Then finally compilescipy:

pip3 install --no-binary :all: --no-use-pep517 scipy

This one worked for me after wasting hours:

pip install --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy