scipy: Unable to install scipy on macOS Big Sur (Intel hardware)
After Big Sur update I’m not able to install scipy in any of my virtualenvs.
pip install scipy
generate this error
numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/ernestoarbitrio/.virtualenvs/histolab/bin/python /Users/ernestoarbitrio/.virtualenvs/histolab/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/3j/s7l7gl410xx64sk3zg9_ngh40000gn/T/tmppxmdgj6o Check the logs for full command output.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 77
- Comments: 76 (29 by maintainers)
Links to this issue
Commits related to this issue
- DOC: document that pip >= 20.3.3 is needed for macOS 11 Closes gh-13363 Closes gh-13361 xref gh-13102 (leaving open, because it contains build-from-source info) [ci skip] — committed to rgommers/scipy by rgommers 3 years ago
- DOC: document that pip >= 20.3.3 is needed for macOS 11 (#13518) Closes gh-13363 Closes gh-13361 xref gh-13102 (leaving open, because it contains build-from-source info) [ci skip] — committed to scipy/scipy by rgommers 3 years ago
Wow, this worked. Thank you:
Install
openblas
:I used
pip3
to installscipy
Success!!!
For anyone else that needs SciPy to just install for now, here’s what I did to make it work:
Download 10_9 wheel from Pypi https://pypi.org/project/scipy/#files
Rename downloaded file to match your tag
$ mv scipy-1.5.4-cp38-cp38-macosx_10_9_x86_64.whl scipy-1.5.4-cp38-cp38-macosx_11_0_x86_64.whl
Install wheel
$ pip install scipy-1.5.4-cp38-cp38-macosx_11_0_x86_64.whl
updating pip did the trick for me (current version 20.3.3) - macOS Big Sur.
Fwiw, I managed to install
scipy
on Big Sur (Intel Macbook) by using the compatibility mode, in which macOS will report being version 10.16 instead of 11.0:This made the trick! Thanks so much for your answer… It works!
Hello! I could finally install scipy on Mac OSX Big Sur thanks to @denizdogan. In my case, since I only needed scipy this is what I did.
Then I executed the following:
And it got installed successfully!
Intel Mac, Big Sur 11.2, pip 21.0.1 (also 20.3.1), poetry 1.1.4, Python 3.9.1.
I hit this same issue while updating a poetry-managed virtualenv today:
After many years of reporting its system version as 10.x, macOS Big Sur reports itself as version 11.x. This breaks various things, including some parts of the Python packaging ecosystem. While we wait for package maintainers to publish 11.x wheels (no rush and we appreciate what you do!), any workaround that maps 10.x forward to 11.x (like renaming wheels), or maps 11.x back to 10.x, should fix the issue.
The easiest option I’ve found is
SYSTEM_VERSION_COMPAT=1 <poetry|pip|pyenv|etc> <command>
. This env var causes macOS to return a version string of 10.x (currently 10.16) instead of 11.x. For scipy, this will find the wheelscipy-1.6.1-cp39-cp39-macosx_10_9_x86_64.whl
instead of building from source.I think this is solved with the new release of pip, which added support for macOSx 11 to install wheels with a 10_9 tag.
I found this thread looking for a way to install librosa on macOS Big Sur 11.1 on Macbook Pro Intel. librosa depends on llvmlite, numpy, and scipy and I had various issues installing each of those dependencies. Finally, I have found a way that works for me and hopefully, this will help someone else.
First of all, you will need to install
llvm@9
andopenblas
from Homebrew:After that, you will need to pass a bunch of environment variables to the
poetry add librosa
command, as described here and other places on the web:Done!
In case you’re having issues, here’s the exact versions of everything I’m using:
I was able to manually install the wheel by going here https://pypi.org/project/scipy/#files and downloading the cPython 3.7 wheel and running.
pip install scipy-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl
The first time it errored out with the message scipy-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl is not a supported wheel on this platform.
I renamed the wheel to scipy-1.5.4-cp37-none-any.whl and ran
pip install scipy-1.5.4-cp37-none-any.whl
and it worked.I am guessing pip is looking for scipy-1.5.4-cp37-cp37m-macosx_11_0_x86_64.whl on BigSur or something.
We ran into this recently as well (using scipy 1.7.0 and Python 3.7.10 together), and what worked for us was:
xcode-select --install
before anything, with latest XCode from App Storebrew install pyenv
pyenv install 3.7.10 && pyenv global 3.7.10
SYSTEM_VERSION_COMPAT=1 pip install scipy
We actually use
Pipenv
, and it helped to splitSYSTEM_VERSION_COMPAT=1 pipenv lock
andpipenv sync
, though likely due to our other dependencies.For me simply upgrading pip solved the problem:
pip install -U pip
This works for me (Big Sur).
I am having the same issue on both Apple Silicon, and Intel. This was working correctly on BigSur a week or two ago but seems to have stopped. I have noticed that a couple of other python libraries with C extensions have quit working too. Checked out devdocs and installing openblas (
brew install openblas
) did not help.update pip
Updating pip version to
21.3.1
solves this problem for meStill failing for me (using
pyenv
) with latest pip (pip 20.3 from /Users/myuser/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pip (python 3.8)
There are Python 3.10 wheels for
x86_64
andarm64
at https://pypi.org/project/scipy/1.8.0/#files. The only thing that won’t be supported is if you’re on macOS 11.x and wantarm64
scipy. Upgrade to macOS 12 andpip install scipy
will work.I successfully installed it on Big Sur with M1 Architecture, by using miniconda! Just by doing
conda install scipy
…!This is all fixed in
pip
. Let’s document the solutions, there are two:pip
(preferred).pip
, the problem can be worked around byexport SYSTEM_VERSION_COMPAT=1
.This issue was for macOS Big Sur on Intel hardware. There are separate issues for
arm64
(M1) hardware. I’ll close this issue.This actually didn’t work… When I tried to
import sklearn
the import failed. @tommydangerous’s solution worked for me! In a Rosetta terminal on macOS Big Sur with the Apple M1 chip.None of the solutions listed here were working for me. What ultimately worked was:
It installed python3.9 in the process at this location
/opt/homebrew/Cellar/python@3.9/3.9.6/bin/python3
, so I have to run this python executable to useimport scipy
.I was able to resolve this morning with a similar solution. Mac OS 11.6 / Intel Steps:
python3 -m venv ~/pyvenv3.9.7
source ~/pyvenv3.9.7/bin/activate
python3 -m pip install --upgrade pip
macOS 11.3.1 Python 3.9.4 pyenv 1.2.27 pipenv 2020.11.15 pip 21.1.1 (this is latest at the time I’m writing) scipy 1.6.3 (not pinned, resolved by pipenv)
Trying to
pipenv install scipy
as a dependency forpipenv install lightgbm
.Only the
export SYSTEM_VERSION_COMPAT=1
solution worked for me. Without this envvar, pipenv was falling back to building from source instead of downloading a wheel.I confirmed the pip version in the virtual environment with
pipenv run pip --version
, and pinned it as described elsewhere withexport VIRTUALENV_PIP=21.1.1
, but this did not help with thepipenv install scipy
.They don’t use the same binaries for installation, among other things
I’m using Poetry (1.1.4), running
poetry install
on my project, so can’t easily go around downloading/renaming files. This is under Python 3.8.6 andpip
20.3 inpyenv
running on an Intel Macbook Pro with Big Sur 11.0.1Full log. Click to expand (long)
It still does not work with Python
3.10.1
even when updatingpip
to the latest version. It does work if I revert to Python3.9.10
instead. Such a pity, I so want to use structural pattern matching!No, we cannot use Accelerate in SciPy, and the NumPy wheels don’t use Accelerate (all wheels ship with OpenBLAS). So there’s nothing that changed with the reintroduction of Accelerate besides from-source builds.
For me using python 3.9.5 instead of 3.10 solved the issue.
@tommydangerous 's solution worked for me on apple silicon. cheers!
If you’re using poetry, I was able to successfully install by running
poetry self update
andpoetry run pip install --upgrade pip
though you don’t have to update poetry.After this
poetry install
worked just fine for me and I was able to run the project just fine.@V0lantis You don’t need Poetry to get it working, pip should be fine. 😃 Replace
poetry add X
withpip install X
and hopefully, that should work. If you still want to use Poetry, you should runpoetry init
, but better yet, just read the official Poetry documentation, it’s pretty simple: https://python-poetry.org/docs/basic-usage/As apple being apple, there was some dynamic linking changing stuff happening (see for example a similar issue for R https://github.com/sethrfore/homebrew-r-srf/issues/35#issuecomment-730396499)
So your poetry machinery is not finding the system packages related to BLAS/LAPACK libraries.
But yes that’s your understanding is correct. Even then, it should be possible to build it on the fly on MacOS without any issues. Then again, I’m not a mac person so your guess is as good as mine. Let’s see if more knowledgeable peepz can figure it out.
Whelp, that doesn’t work, pypi refuses the renamed files as duplicates.
All bets are off for apple silicon, I don’t think we’ve tried building on there yet, but it’ll come.
Not sure about Big Sur and Intel though, I would’ve thought building would work there. However, it’s not clear why a prebuilt wheel isn’t being installed to start with. Does numpy install and run its test suite ok?
Check out the devdocs, http://scipy.github.io/devdocs/building/macosx.html, they may help.