136

When installing scipy through pip with :

pip install scipy

Pip fails to build scipy and throws the following error:

Cleaning up...
Command /Users/administrator/dev/KaggleAux/env/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/administrator/dev/KaggleAux/env/build/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zl/7698ng4d4nxd49q1845jd9340000gn/T/pip-eO8gua-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/administrator/dev/KaggleAux/env/bin/../include/site/python2.7 failed with error code 1 in /Users/administrator/dev/KaggleAux/env/build/scipy
Storing debug log for failure in /Users/administrator/.pip/pip.log

How can I get scipy to build successfully? This may be a new issue with OSX Yosemite since I just upgraded and haven't had issues installing scipy before.


Debug log:

Cleaning up...
  Removing temporary dir /Users/administrator/dev/KaggleAux/env/build...
Command /Users/administrator/dev/KaggleAux/env/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/administrator/dev/KaggleAux/env/build/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zl/7698ng4d4nxd49q1845jd9340000gn/T/pip-eO8gua-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/administrator/dev/KaggleAux/env/bin/../include/site/python2.7 failed with error code 1 in /Users/administrator/dev/KaggleAux/env/build/scipy
Exception information:
Traceback (most recent call last):
  File "/Users/administrator/dev/KaggleAux/env/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Users/administrator/dev/KaggleAux/env/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Users/administrator/dev/KaggleAux/env/lib/python2.7/site-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Users/administrator/dev/KaggleAux/env/lib/python2.7/site-packages/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Users/administrator/dev/KaggleAux/env/lib/python2.7/site-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /Users/administrator/dev/KaggleAux/env/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/administrator/dev/KaggleAux/env/build/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zl/7698ng4d4nxd49q1845jd9340000gn/T/pip-eO8gua-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/administrator/dev/KaggleAux/env/bin/../include/site/python2.7 failed with error code 1 in /Users/administrator/dev/KaggleAux/env/build/scipy
agconti
  • 17,780
  • 15
  • 80
  • 114

20 Answers20

134

After opening up an issue with the SciPy team, we found that you need to upgrade pip with:

pip install --upgrade pip

And in Python 3 this works:

python3 -m pip install --upgrade pip

for SciPy to install properly. Why? Because:

Older versions of pip have to be told to use wheels, IIRC with --use-wheel. Or you can upgrade pip itself, then it should pick up the wheels.

Upgrading pip solves the issue, but you might be able to just use the --use-wheel flag as well.

Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
agconti
  • 17,780
  • 15
  • 80
  • 114
  • 15
    This worked for me -- but I also had to install Luke's suggested packages `sudo apt-get install libatlas-base-dev gfortran` – BenB Jun 26 '15 at 23:24
  • I had to remove the old version of pip before upgrading. Then it worked perfectly. – Autonomous Aug 02 '15 at 05:31
  • 2
    Also, on my perfectly fresh 14.04 install, I also had to `sudo apt-get install python-dev` – BenB Feb 09 '16 at 19:05
  • I was having a lot of pip package errors when doing the installation. Upgrading pip resolved all the errors. – burhan rashid Aug 04 '22 at 14:29
92

Microsoft Windows users of 64 bit Python installations will need to download the 64 bit .whl of Scipy from here, then simply cd into the folder you've downloaded the .whl file and run:

pip install scipy-0.16.1-cp27-none-win_amd64.whl
Mooncrater
  • 4,146
  • 4
  • 33
  • 62
Conor
  • 3,279
  • 1
  • 21
  • 35
  • 28
    `scipy-0.16.1-cp27-none-win_amd64.whl is not a supported wheel on this platform.` – Watchmaker Sep 19 '16 at 10:36
  • 17
    @gugol Perhaps you already tried this but you have to make sure the numbers after cp match your python version(e.g. cp34 = 3.4) and the amd64/win32 is correct. – fdsa Oct 31 '16 at 04:41
  • 5
    `D:\TEMP>pip install "scipy-0.19.1-cp35-cp35m-win_amd64.whl" Requirement 'scipy\u20110.19.1\u2011cp35\u2011cp35m\u2011win_amd64.whl' looks li ke a filename, but the file does not exist scipy\u20110.19.1\u2011cp35\u2011cp35m\u2011win_amd64.whl is not a valid wheel f ilename. D:\TEMP>pip install "test.whl" test.whl is not a valid wheel filename. D:\TEMP>pip install test.whl test.whl is not a valid wheel filename.` I cd to the directory try to run it then get an error,. Then I change the filename try to run it get another error. Method doesnt work... – user32882 Aug 04 '17 at 05:52
  • 1
    I'm seeing the same issue as @user32882. What is it that we are doing wrong? – gen Sep 05 '17 at 08:49
  • @gugol I had the same problem, the note from @Cyclotron3x3 helped me out; the `-cp27` in the file name refers to the version of python, I had to find the file with `-cp36` in the file name to match with my version of Python: 3.6. – Benson May 20 '18 at 02:59
67

I face same problem when install Scipy under ubuntu.
I had to use command:

$ sudo apt-get install libatlas-base-dev gfortran
$ sudo pip3 install scipy

You can get more details here Installing SciPy with pip
Sorry don't know how to do it under OS X Yosemite.

Community
  • 1
  • 1
Xin Cheng
  • 1,432
  • 10
  • 17
41

In windows 10, most options will not work. Follow these steps:

In Windows 10 with CMD, you cannot download scipy directly using most of the well known commands like wget, cloning scipy github, pip install scipy, etc

To install, go to pythonlibs .whl files , and if you are using python 2.7 32 bit then download numpy-1.11.2rc1+mkl-cp27-cp27m-win32.whl and scipy-0.18.1-cp27-cp27m-win32.whl or if python 2.7 62 bit then download numpy-1.11.2rc1+mkl-cp27-cp27m-win_amd64.whl and scipy-0.18.1-cp27-cp27m-win_amd64.whl

After downloading,save the files under your python directory , in my case it was c:\>python27

Then run:

pip install C:\Python27\numpy-1.11.2rc1+mkl-cp27-cp27m-win32.whl 
pip install C:\Python27\scipy-0.18.1-cp27-cp27m-win32.whl

Note:

  1. scipy needs numpy as dependency, so that's why we are downloading numpy before scipy.
  2. cp27 in .whl files means that these files are meant for python 2.7 and cp33 stands for python 3.x speciafically >=3.3
Community
  • 1
  • 1
Cyclotron3x3
  • 2,188
  • 23
  • 40
  • This worked for me on win 10 with Python 3.5 and 64b machine pip install numpy-1.13.1+mkl-cp35-cp35m-win_amd64.whl pip install numpy-1.13.1+mkl-cp35-cp35m-win_amd64.whl – vlad Jul 25 '17 at 13:32
  • This answer solved the problem in my case (Windows 8.1), but I also needed to download and install [numpy+mkl](http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) wheel. Do this if you get an ImportError "NUMPY_MKL" when trying to import scipy after following this answer. Credits to [@VMAtm](https://stackoverflow.com/questions/37267399/importerror-cannot-import-name-numpy-mkl#answer-37281256). – Renato Byrro Aug 28 '17 at 00:42
  • For Python 3.6.2 on Windows 10 use `scipy-0.19.1-cp36-cp36m-win_amd64.whl` – Dmitry Sep 10 '17 at 00:47
  • Thanks!, to use imread i was needed to install Pillow also --pip install Pillow – limitless Oct 24 '17 at 07:57
  • For newer versions you need to install both `numpy` and `mkl` before scipy – Pleastry Oct 28 '21 at 10:52
13

After finding this answer for some clues, I got this working by doing

brew install gcc 
pip install scipy

(The first of these steps took 96 minutes on my 2011 Mac Book Air so I hope you're not in a hurry!)

Community
  • 1
  • 1
Liz Rice
  • 589
  • 6
  • 9
  • I was actually unable to `brew install gcc`. It ended up throwing a bunch of errors. But after working with the Scipy guys; I found a solution. Thanks for your answer! – agconti Nov 17 '14 at 03:02
  • This actually turned out to be the straight forward solution for me. End up not building and installing downloaded scipy kit. :) – Sean Jul 25 '16 at 01:57
  • This worked for me, and it only took a few seconds for the first step – André Fratelli Apr 14 '20 at 06:31
9

If you are totally new to python read step by step or go directly to last step. Follow the below method to install scipy 0.18.1 on Windows 64-bit , Python 64-bit . If below command is not working then proceed further

pip install scipy

Be careful with the versions of

  1. Python

  2. Windows

  3. .whl version of numpy and scipy files

  4. First install numpy and scipy.

    pip install FileName.whl
    
  5. For Numpy:http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy For Scipy:http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

Be aware of the file name (check the version number).

Ex :scipy-0.18.1-cp35-cp35m-win_amd64.whl

To check which version is supported by your pip, go to point No 2 below.

If you are using .whl file . Following errors are likely to occur .

  1. You are using pip version 7.1.0, however version 8.1.2 is available.

You should consider upgrading via the 'python -m pip install --upgrade pip' command

  1. scipy-0.15.1-cp33-none-win_amd64.whl.whl is not supported wheel on this platform

For the above error: start Python and type :

import pip
print(pip.pep425tags.get_supported())

Output:

[('cp35', 'cp35m', 'win_amd64'), ('cp35', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp35', 'none', 'any'), ('cp3', 'none', 'any'), ('py35', 'none', 'any'), ('py3', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

In the output you will observe cp35 is there , so download cp35 for numpy as well as scipy.Further edits are most welcome.

Abdelhakim AKODADI
  • 1,556
  • 14
  • 22
Arun Naudiyal
  • 361
  • 4
  • 4
9

For Windows 10

C:\directory> pip install scipy-0.19.0rc2-cp35-cp35m-win_amd64.whl

Ayudh Hande
  • 91
  • 1
  • 4
6

Rather than going the harder route of downloading specific packages. I prefer to go the faster route of using Conda. pip has its issues.

  • Python -v (3.6.0)
  • Windows 10 (64 bit)

Conda , install conda from : https://conda.io/docs/install/quick.html#windows-miniconda-install

command prompt

C:\Users\xyz>conda install -c anaconda scipy=0.18.1
Fetching package metadata .............
Solving package specifications:

Package plan for installation in environment C:\Users\xyz\Miniconda3:

The following NEW packages will be INSTALLED:

mkl:       2017.0.1-0         anaconda
numpy:     1.12.0-py36_0      anaconda
scipy:     0.18.1-np112py36_1 anaconda

The following packages will be SUPERCEDED by a higher-priority channel:

conda:     4.3.11-py36_0               --> 4.3.11-py36_0 anaconda
conda-env: 2.6.0-0                     --> 2.6.0-0       anaconda

Proceed ([y]/n)? y

conda-env-2.6. 100% |###############################| Time: 0:00:00  32.92 kB/s
mkl-2017.0.1-0 100% |###############################| Time: 0:00:24   5.45 MB/s
numpy-1.12.0-p 100% |###############################| Time: 0:00:00   5.09 MB/s
scipy-0.18.1-n 100% |###############################| Time: 0:00:02   5.59 MB/s
conda-4.3.11-p 100% |###############################| Time: 0:00:00   4.70 MB/s
Sandeep Anand
  • 426
  • 7
  • 13
5
  1. Download SciPy from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
  2. Go into the directory the downloaded file is in and pip install the file.
  3. Go to python shell, run import scipy; it worked for me with no errors.
Box and Cox
  • 174
  • 2
  • 5
5

This is an alternative to pip. I also had the same error when installing scipy with pip.

Then I downloaded and installed MiniConda. And then I used the below command to install pytables.

conda install -c conda-forge scipy

Please refer the below screenshot.

enter image description here

Tharindu Kumara
  • 4,398
  • 2
  • 28
  • 46
3

the best method I could suggest is this

  1. Download the wheel file from this location for your version of python

  2. Move the file to your Main Drive eg C:>

  3. Run Cmd and enter the following

    • pip install scipy-1.0.0rc1-cp36-none-win_amd64.whl

Please note this is the version I am using for my pyhton 3.6.2 it should install fine

you may want to run this command after to make sure all your python add ons are up to date

pip list --outdated
Kobra
  • 31
  • 5
1

Alternatively, manually download and execute http://www.lfd.uci.edu/~gohlke/pythonlibs Scipy version suitable for you. Consider your Python version (python --version) and your system architecture (32/64 bit). Choose the Scipy version accordingly. scipy-0.18.1-cp27-cp27m-win32 - for Python 2.7 32 bit scipy-0.18.1-cp27-cp27m-win_amd64 - for Python 2.7 64 bit Otherwise the error scipy-0.15.1-cp33-none-win_amd64.whl.whl is not supported wheel on this platform will popup on installation.

Now change directory to the downloaded file and execute command pip install scipy-0.15.1-cp33-none-win_amd64.whl.whl (change file name appropriately)

I have added this answer only because the Arun's answer(found useful by myself) has not mentioned anything about 32/64 bit matching which i have faced.

Nipun Thathsara
  • 1,119
  • 11
  • 20
1

I was having the same issue, and I had succeeded using sudo.

$ sudo pip install scipy
lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
Zico
  • 127
  • 16
1

I experienced similar issues with Python 3.7 (3.7.0b4). This was due to some changes regarding some encoding assumptions (Python 3.6 >> Python 3.7)

As a result lots of package installations (e.g. via pip) failed.

holzkohlengrill
  • 1,044
  • 19
  • 29
0

If you are using CentOS you need to install lapack-devel like so:

 $ yum install lapack-devel
Chris Johnson
  • 20,650
  • 6
  • 81
  • 80
Nazilla
  • 581
  • 1
  • 7
  • 17
0

Try downloading the scipy file from the below link

https://sourceforge.net/projects/scipy/?source=typ_redirect

It will be a .exe file and you just need to run it. But be sure to chose the scipy version corresponding to your python version.

When the scipy.exe file is run it will locate the python directory and will be installed .

u_found_me
  • 111
  • 1
  • 5
0

use the wheel file to install download from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy install

pip install c:\jjjj\ggg\fdadf.whl
KeepLearning
  • 517
  • 7
  • 10
0

The easiest way is in the following steps: Fixing scipy for python [ 2.n < python < 3.n ]

Download the necessary files from: http://www.lfd.uci.edu/~gohlke/pythonlibs/

Download the version of numpy+mkl (needed to run scipy) and then download scipy for your python type (2.n python written as 2n) or (3.n python written as 3n), n is a variable. Note you must know whether you have a 32bit or 64bit processor.

Create a directory somewhere on your computer, example [C:\DIRECTORY] to install the files numpy+mkd.whl and scipy.whl

Once both file are downloaded, find the location of the file on your computer and move it to the directory you created.

Example: First file installation is needed for scipy is in

C:\DIRECTORY\numpy\numpy-0.0.0+mkl-cp2n-cp2nm-win_amd32.whl

Example: Second file installation is in

C:\DIRECTORY\scipy\scipy-0.0.0-cp2n-cp2nm-win_amd32.whl

Go to your command prompt and proceed the following example for a python version 2.n:

py -2.n -m pip install C:\DIRECTORY\numpy\numpy-0.0.0+mkl-cp2n-cp2nm-win_amd32.whl

should install

py -2.n -m pip install C:\DIRECTORY\scipy\scipy-0.0.0-cp2n-cp2nm-win_amd32.whl

should install

Test both modules on your python IDLE as following:

import numpy

import scipy

the modules are working if no errors are returned.

IFDAAS

Community
  • 1
  • 1
0

For windows(7 in my case):

  1. download scipy-0.19.1-cp36-cp36m-win32.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
  2. create one some.bat file with content

    @echo off C:\Python36\python.exe -m pip -V C:\Python36\python.exe -m pip install scipy-0.19.1-cp36-cp36m-win32.whl C:\Python36\python.exe -m pip list pause

  3. then run this batch file some.bat

  4. call python shell "C:\Python36\pythonw.exe "C:\Python36\Lib\idlelib\idle.pyw" and test if scipy was installed with

import scipy

Ion Stefanache
  • 147
  • 1
  • 4
0

You can test this answer:

python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
Farshid Shekari
  • 2,391
  • 4
  • 27
  • 47