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).
We can install the SciPy library by using pip command; run the following command in the terminal: pip install scipy.
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
This solution worked on my M1 machine with pyenv
:
brew install openblas
OPENBLAS="$(brew --prefix openblas)" pip install numpy scipy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With