question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Still unable to install SciPy

See original GitHub issue

Describe your issue.

Hi, I just got the MBA M1 and I am trying to install SciPy, but for some reason I am getting errors which I don’t quite understand. Would appreciate any advice on how to move forward. I am running Monterey 12.0.1. I have been able to install most libraries, just scipy has been giving me problems. The whole error message is too long to post, but I can reply with relevant information, just get back to me on this thread.

Reproducing Code Example

~ % brew --version
Homebrew 3.3.3
Homebrew/homebrew-core (git revision 4530cc439e5; last commit 2021-11-12)
Homebrew/homebrew-cask (git revision e60e8f7a05; last commit 2021-11-13)
~ % pip install cython pybind11 pythran numpy
Requirement already satisfied: cython in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (0.29.24)
Requirement already satisfied: pybind11 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (2.8.1)
Requirement already satisfied: pythran in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (0.10.0)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (1.21.4)
Requirement already satisfied: beniget~=0.4.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pythran) (0.4.1)
Requirement already satisfied: gast~=0.5.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pythran) (0.5.2)
Requirement already satisfied: ply>=3.4 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pythran) (3.11)
~ % OPENBLAS=$(brew --prefix openblas) CFLAGS="-falign-functions=8 ${CFLAGS}" pip install --no-use-pep517 scipy==1.7.0

Error message

ollecting scipy==1.7.0
  Using cached scipy-1.7.0.tar.gz (36.1 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy<1.23.0,>=1.16.5 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from scipy==1.7.0) (1.21.4)
Building wheels for collected packages: scipy
  Building wheel for scipy (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-install-otct1we2/scipy_443d1f5e1f1e403f84a3325c1b1e3401/setup.py'"'"'; __file__='"'"'/private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-install-otct1we2/scipy_443d1f5e1f1e403f84a3325c1b1e3401/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-wheel-uozvxwo6
       cwd: /private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-install-otct1we2/scipy_443d1f5e1f1e403f84a3325c1b1e3401/



 error: Command "ar rcs build/temp.macosx-10.9-universal2-3.9/libsc_cephes.a build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/scipy_iv.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/shichi.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/sici.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/sindg.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/sinpi.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/spence.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/stdtr.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/struve.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/tandg.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/tukey.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/unity.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/yn.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/yv.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/zeta.o build/temp.macosx-10.9-universal2-3.9/scipy/special/cephes/zetac.o" failed with exit status 1
    
    ########### CLIB COMPILER OPTIMIZATION ###########
    Platform      :
      Architecture: unsupported
      Compiler    : gcc
    
    CPU baseline  :
      Requested   : optimization disabled
      Enabled     : none
      Flags       : none
      Extra checks: none
      Requested   : optimization disabled
    
    CPU dispatch  :
      Enabled     : none
      Generated   : none
    CCompilerOpt.cache_flush[809] : write cache to path -> /private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-install-otct1we2/scipy_443d1f5e1f1e403f84a3325c1b1e3401/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_clib.py
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-install-otct1we2/scipy_443d1f5e1f1e403f84a3325c1b1e3401/setup.py'"'"'; __file__='"'"'/private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-install-otct1we2/scipy_443d1f5e1f1e403f84a3325c1b1e3401/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/lx/_pkqc2sj3x9g0yfndm_4n4vh0000gn/T/pip-record-bkv6xrzk/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/scipy Check the logs for full command output.

SciPy/NumPy/Python version information

print(numpy.version, sys.version_info) 1.21.4 sys.version_info(major=3, minor=9, micro=8, releaselevel=‘final’, serial=0)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nevess99commented, Nov 16, 2021

@psobolewskiPhD Thanks. I used pip install --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy and it worked for me.

1reaction
psobolewskiPhDcommented, Nov 14, 2021

I’m also on M1 Monterey. It looks like you are using the apple python install? Perhaps try getting set up with a conda env using miniforge3 (or mamba): https://github.com/conda-forge/miniforge (make sure it’s the MacOS arm64 version) Then create an env: conda create -y -n scipy-test python=3.9 (You can replace scipy-test with whatever name you want). Did you install OpenBLAS using homebrew? If so you may want to export that so pip knows about it: export OPENBLAS=/opt/homebrew/opt/openblas/lib/ (adjust this based on your shell, e.g. in fish it’s set -x OPENBLAS /opt/homebrew/opt/openblas/lib/ Make sure you activate your new env: conda activate scipy-test and then a simple: pip install scipy should work.

BTW If you don’t want to be building scipy, you can always use conda to install a binary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install Scipy through pip - Stack Overflow
In Windows 10 with CMD, you cannot download scipy directly using most of the well known commands like wget , cloning scipy github...
Read more >
BUG: Cannot install scipy version <1.6.0 with pip · Issue #15438
Describe your issue. Hi, i'm using python 3.10. I'm trying to install an <1.6.0 scipy version of scipy as it's needed for a...
Read more >
Can't install scipy, can someone please help? : r/Python - Reddit
The quickest and simplest answer is: download Anaconda and install it. It comes with all scientific packages (including scipy) available for you ...
Read more >
Installation - SciPy
System package managers, like apt-get , install across the entire computer, often have older versions, and don't have as many available versions.
Read more >
SciPy - PyPI
scipy 1.9.3. pip install scipy. Copy PIP instructions. Latest version. Released: Oct 19, 2022.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found