5

I have Python 2.7.9 on windows 7 64-bits. I'm trying to install scipy using pip. I used pip install scipy but I get the following error :

Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\us
ers\\admin\\appdata\\local\\temp\\pip-build-xpl5cw\\scipy\\setup.py';exec(compil
e(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file
__, 'exec'))" install --record c:\users\admin\appdata\local\temp\pip-b68pfc-reco
rd\install-record.txt --single-version-externally-managed --compile" failed with
 error code 1 in c:\users\admin\appdata\local\temp\pip-build-xpl5cw\scipy

I searched on google and stackoverflow for solutions but nothing worked. I tried upgrading pip and it didn't work too.

Here are my installed packages and their versions :

httplib2 (0.9.1)
nltk (3.0.3)
nose (1.3.7)
numpy (1.9.2)
pip (7.0.3)
pytz (2015.4)
scikit-learn (0.16.1)
setuptools (17.1.1)
six (1.9.0)
twilio (4.4.0)
wheel (0.24.0)
Rodolphe LAMPE
  • 1,346
  • 2
  • 11
  • 17
  • What is the full stack trace? You likely need to `sudo apt-get install` a few things along with `scipy` as it has quite a few dependencies. I recall having to do that for a few libraries when installing scipy a while back. – kylieCatt Jun 18 '15 at 15:19
  • 1
    Get a binary. http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy Possible duplicate of here: http://stackoverflow.com/questions/28142839/pip-install-numpy-python-2-7-fails-with-errorcode-1 – Alex Huszagh Jun 18 '15 at 15:19
  • @IanAuld, this is Windows. Not Ubuntu or another Linux distro with an aptitude repository. – Alex Huszagh Jun 18 '15 at 15:20
  • @AlexanderHuszagh Agreed, it's a dup. I'm sure I've asked the same question before myself, in fact. I was using a newer version of Python, but the solution is the same. – Hack-R Jun 18 '15 at 15:21
  • possible duplicate of [How to Install scipy in Windows 7 with Python 3.4.2](http://stackoverflow.com/questions/27952349/how-to-install-scipy-in-windows-7-with-python-3-4-2) – Hack-R Jun 18 '15 at 15:22
  • You can install scipy as explained in [Scipy website installation instructions](https://www.scipy.org/install.html) – Orhan Celik Sep 12 '17 at 15:32
  • Try to download scipy package from [here](https://pypi.python.org/pypi/scipy) – Andersson Jun 18 '15 at 15:31

5 Answers5

3

I'm on Ubuntu 14.04. I tried installing through pip which kept on failing with error code 1 or took forever to finish (never finished actually!). However, the following command worked without a hitch:

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Reference: http://www.scipy.org/install.html

Zahra
  • 6,798
  • 9
  • 51
  • 76
  • **user25111** asked for help for Python + Scipy on Windows. Your answer is for linux systems. – leber33 Sep 01 '16 at 11:58
  • 2
    That's the reason why I had clearly stated this is for Ubuntu. A lot of users, including myself, arrive at this question when looking for a solution for the same problem on a non-windows OS. I added this answer to help the general audience not only the asker. – Zahra Sep 03 '16 at 19:36
2

On Windows, you'll need to use the unofficial precompiled binaries:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Select the version matching your architecture and Python version.

Hack-R
  • 22,422
  • 14
  • 75
  • 131
  • @RodolpheLAMPE what do I do once I have downloaded scipy .whl file ? I am using windows 10 – Murlidhar Fichadia Oct 08 '17 at 16:19
  • @RodolpheLAMPE Yes, you have to download the version that matches your Python version – Hack-R Oct 08 '17 at 16:27
  • @MurlidharFichadia Just install it `pip install some-package.whl` – Hack-R Oct 08 '17 at 16:27
  • @Hack-R I downloaded the scipy `.whl` file and then when I did `pip install filename.whl` I get : `C:\Python27\python.exe: can't find '__main__' module in 'scipy-0.19.1-cp27-cp27m-win32.whl'` – Murlidhar Fichadia Oct 08 '17 at 16:28
  • @MurlidharFichadia I'm not able to reproduce the error. Make sure you are using the correct version and architecture. For instance that's only the right file if you have 32-bit Windows and Python 2.7. Almost no one uses 32-bit Windows anymore, so I doubt you downloaded the correct file. Also make sure all dependencies have been met. If you still have the problem please start a new question about it. – Hack-R Oct 08 '17 at 16:31
2

Installing setuptools made it work for me (Mac OS)

pip install -U pip setuptools
2

I also had the same error when installing scipy.

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
0

On windows you can check below command:

python -m pip install psycopg2
Reza Rahemtola
  • 1,182
  • 7
  • 16
  • 30