pip failing to build wheels for scipy

alex_lewis picture alex_lewis · Oct 18, 2019 · Viewed 11.2k times · Source

I've just downloaded the new python 3.8 and I'm trying to install the scipy package using the following:

pip3.8 install scipy

However the build fails with the following error:

**Failed to build scipy**

**ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly**

How can I install this using pip? I tried using the --no-binary version:

pip3.8 install --no-binary :all: scipy

but ended up with an even scarier error:

**ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8p/01_5ykld02v61rtjl8k_8j200000gp/T/pip-install-wlnk_0jg/scipy/setup.py'"'"'; __file__='"'"'/private/var/folders/8p/01_5ykld02v61rtjl8k_8j200000gp/T/pip-install-wlnk_0jg/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/8p/01_5ykld02v61rtjl8k_8j200000gp/T/pip-record-01j_ddt8/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.**

Answer

S. R. Colledge picture S. R. Colledge · Oct 24, 2019

I think I got the same issue as you did. Did the error code have this message

error: library dfftpack has Fortran sources but no Fortran compiler found?

Because to me, it sounds like a Fortran compiler error, and not a mistake of python per se. I think what happens is that the wheel requires some sort of Fortran compiler and when the installation doesn't find one it simply terminates the build. Here is the solution that I found:

Linux

sudo apt install gfortran

Windows / Mac

Download it from here: https://gcc.gnu.org/wiki/GFortran#download

This solution fixed it for me. Check out: Still can't install scipy due to missing fortran compiler after brew install gcc on Mac OS X for more details.