failed to install Scipy via `pip` (OSX M1)
See original GitHub issueSystem Environment:
macOS Big Sur 11.5.2, M1 processor
Python 3.8.11 (using a venv
)
pip==21.2.4 (updated via pip
)
setuptools==57.4.0 (updated via pip
)
Observed output
(venv) % python -m pip install scipy
Collecting scipy
Using cached scipy-1.7.1.tar.gz (36.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Users/work/Repos/endaq-python-calc/venv/bin/python /Users/work/Repos/endaq-python-calc/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/1s/lrjbk2v17m7063f944nmy7vh0000gn/T/tmp7dun4f3u
cwd: /private/var/folders/1s/lrjbk2v17m7063f944nmy7vh0000gn/T/pip-install-cc3mdfet/scipy_90eec6ff22e54b9d84809dedc230c072
Complete output (4 lines):
setup.py:490: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/var/folders/1s/lrjbk2v17m7063f944nmy7vh0000gn/T/pip-modern-metadata-0oa55ptb'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Error: 'None' must be installed before running the build.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/47/33/a24aec22b7be7fdb10ec117a95e1e4099890d8bbc6646902f443fc7719d1/scipy-1.7.1.tar.gz#sha256=6b47d5fa7ea651054362561a28b1ccc8da9368a39514c1bbf6c0977a1c376764 (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10). Command errored out with exit status 1: /Users/work/Repos/endaq-python-calc/venv/bin/python /Users/work/Repos/endaq-python-calc/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/1s/lrjbk2v17m7063f944nmy7vh0000gn/T/tmp7dun4f3u Check the logs for full command output.
It then tries other versions of scipy
, but they all result in the same message.
Any help appreciated, thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to install SciPy on Apple Silicon (ARM / M1)
This solution worked on my M1 machine with pyenv : brew install openblas OPENBLAS="$(brew --prefix openblas)" pip install numpy scipy.
Read more >Install Python with NumPy SciPy Matplotlib on macOS Big Sur ...
I will show you how to install natively the above three libraries, using arm64 Apple Silicon versions. I assume that you have one...
Read more >Apple silicon M1 for the many-body physicist | by Alex Schuckert
I have an M1 Pro with 10 cores. Now you need to make sure that whatever package you install does not install numpy...
Read more >How to Install Scipy in Python on MacOS? - GeeksforGeeks
Follow the below steps to install the Scipy package on macOS using pip: Step 1: Install the latest Python3 in MacOS.
Read more >Install Python with NumPy SciPy Matplotlib on ... - YouTube
How to install Python with NumPy, SciPy, Matplotlib on macOS Big Sur Apple Silicon M1.The procedure presented in the video should work on ......
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
More fixes for anyone else with the same problem (and as a reference for myself, if we’re being honest):
So this resulted in some errors for me due to, afaik, missing c-library dependencies when compiling from source.
Now I could dig into these C compilation issues. But I’m a Python developer on a time budget, so I’m going to instead opt for the easier solution.
The easier solution
Check your Python interpreter
If you install python through the installer available directly from https://www.python.org/, you’ll install a universal binary. You can tell it’s a universal binary because running in the command line
which python3 | xargs file
prints to stdout something like the below message, which makes note of bothx86_64
andarm64
architectures:(If you installed via another means like e.g. Homebrew, as long as the above command prints the same result this will still work.)
Set
zsh
to run programs inx86_64
modeBy default, Terminal (i.e.,
zsh
) will run programs inarm64
mode; this is evidenced by the result of runninguname -m
:This can be changed on either a command-, terminal-session- or permanent-basis using the
arch
command. Below I opt for the session-basis change:Install
scipy
as usualNow after setting up
zsh
inx86_64
mode, runningpip
will install binaries for thex86_64
architecture, with whichscipy
has perfectly functional compatibility. At the time of writing this, I’ve successfully installedscipy==1.7.1
on my system with this method. If you’re reading this, I hope it helps you too 😃@CrepeGoat No worries at all. Best of luck.