43

I am trying to install the SciPy stack located at https://scipy.org/stackspec.html [I am only allowed 2 links; trying to use them wisely]. I realize that there are much easier ways to do this, but I think there is a lot to be learned by doing it manually. I am relatively new to a lot of this stuff, so I apologize if I sound ignorant at any point.

I am running Windows 7 Enterprise - 64 bit. Here is what I have done so far:

  1. Installed python-2.7.8.msi (32-bit) from https://www.python.org/download/releases/2.7.8/

  2. Installed numpy-1.8.1-win32-superpack-python2.7 from http://sourceforge.net/projects/numpy/files/
    Test: import numpy as np ---> no errors

  3. Installed scipy library,
    scipy-0.14.0-win32-superpack-python2.7.exe from (SCIPY DOT ORG LINK REMOVED) Test: import scipy as sp ---> no errors

  4. Installed matplotlib: matplotlib-1.3.1.win32-py2.7.exe from (MATPLOTLIB DOT ORG LINK REMOVED)

  5. Installed PIP by running script here: https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py I just copied-pasted script to a new file in IDLE,
    saved as C:\Python27\Scripts\pip_install.py and clicked Run>module. No errors reported.

Does the path on which I saved pip_install.py matter?


6. HERE IS WHERE I FAIL

Attempted to install matlibplot dependency dateutil: Opened a Cygwin Shell, and typed

        cd C:\Python27          ! is it necessary to cd to python directtory?
        pip install python-dateutil

This results in the error:

    bash: pip: command not found

I get the same error attempting from cmd.

Any help is appreciated; the closest I found was bash: pip: command not found. But the OSX nature of it is just enough to confise me further.


UPADTE:

I added the pip-path per Paul H's suggestion below. It made the error go away, but strangely, nothing I pip actually installs. For example, in Cygwin, I type:

cbennett2> pip install python-dateutil
cbennett2>                            

You can see that there is no output or feedback from the shell (which I think there should be). Then when I go to a new python shell:

>>> from dateutil.parser import parse
Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    from dateutil.parser import parse
ImportError: No module named dateutil.parser
>>>>

This happens with all of the modules that I thought I had pip'd ... pandas, tornado, etc.

Black Thunder
  • 5,331
  • 5
  • 22
  • 52
Saladsamurai
  • 577
  • 1
  • 5
  • 9

8 Answers8

88

On Windows, pip lives in C:\[pythondir]\scripts.

So you'll need to add that to your system path in order to run it from the command prompt. You could alternatively cd into that directory each time, but that's a hassle.

See the top answer here for info on how to do that: Adding Python Path on Windows 7

Also, that is a terrifying way to install pip. Grab it from Christophe Gohlke. Grab everything else from there for that matter. http://www.lfd.uci.edu/~gohlke/pythonlibs/

Community
  • 1
  • 1
Paul H
  • 52,530
  • 16
  • 137
  • 125
  • Sorry, but I had to un-accept as I still cannot pip. I mistook the lack of an error for pip working. Now it just does nothing. Updating question now. – Saladsamurai Aug 15 '14 at 23:25
  • @Saladsamurai did you remove that wacky version of `pip` that you had copy-pasted first? – Paul H Aug 15 '14 at 23:30
  • and did you run the installer? – Paul H Aug 15 '14 at 23:33
  • I did not. I believe that the items located at Chris' site are technically "unsupported/unofficial" .... that is fine with me, but really I feel like I should be able to do this the "official" way, shouldn't I? – Saladsamurai Aug 16 '14 at 01:14
  • on windows all bets are off. if you didn't run his installer, what did you expect to happen? use his binaries or use anaconda @Saladsamurai – Paul H Aug 16 '14 at 01:15
  • I will trust you because you obviously use this stuff a lot. But to answer your question: "What did I expect to happen?" I expected that I could follow the python specification located on the python official page and get python installed. Is that too much to ask? Why should I have to rely on "some guy's" binaries? Even if he is a python wizard. – Saladsamurai Aug 16 '14 at 01:21
  • 2
    There are a couple of things going on. First is that, whether you intended to or not, you likely have two version of python. One is isolated in cygwin, the other you installed via the installers and is available to your whole system. On Windows, it's just going to be a pain. This is dead simple of Linux, and a mild annoyance on Mac OS X. Windows will always be a 2nd class citizen in this regard. Continuum, the company behind anaconda, recognized this and made their free product, which will behave exactly as you desire. C'est la vie. (@Saladsamurai) – Paul H Aug 16 '14 at 01:25
  • 1
    @Saladsamurai worth noting that packages installed in one of your pythons will *not* be available in the other. they are totally isolated from each other. – Paul H Aug 16 '14 at 01:26
34

As long as pip lives within the scripts folder you can run

python -m pip ....

This will tell python to get pip from inside the scripts folder. This is also a good way to have both python2.7 and pyhton3.5 on you computer and have them in different locations. I currently have both python2 and pyhton3 installed on windows. When I type python it defaults to python2. But if I type python3 I can use python3. (I also had to change the python.exe file for python3 to "python3.exe")If I need to install flask for python 2 I can run

python -m pip install flask

and it will be installed in the pyhton2 folder, but if I need flask for python 3 I run:

python3 -m pip install flask

and I now have it in the python3 folder

Buzz
  • 1,751
  • 20
  • 24
12
  1. press [win] + Pause
  2. Advanced settings
  3. System variables
  4. Append ;C:\python27\Scripts to the end of Path variable
  5. Restart console
Ivan Temchenko
  • 644
  • 7
  • 11
  • 5
    for anyone else out there, [win] + pause is still a valid keyboard shortcut in windows 10 – worc Feb 27 '16 at 18:41
4

I found this much simpler. Simply type this into the terminal:

PATH=$PATH:C:\[pythondir]\scripts 
ella2469
  • 41
  • 2
4

On windows 7, you have to use this command: python -m pip install xxx. All above don't work for me.

Dat TT
  • 2,106
  • 13
  • 15
3

If this is for Cygwin, it installs "pip" as "pip2". Just create a softlink to "pip2" in the same location where "pip2" is installed.

FearlessFuture
  • 1,860
  • 3
  • 16
  • 23
1

I had a similar problem running SciPy on my computer. There are two ways to fix this problem: 1. Yes you do need to cd into your python directory. 2. Sometimes you have to tell the computer explicitly what path to go through, you have to find the program you're using, open up the properties, and reroute the path it takes to run. 3. consult the manual: http://matplotlib.org/users/installing.html or http://www.scipy.org/install.html

the Scipy package is very finicky, and needs things spelled out in obnoxious detail.

user2954167
  • 127
  • 1
  • 3
  • 13
0

The problem is that your Python version and the library you want to use are not same versionally (Python). Even if you install Python's latest version, your PATH might not change properly and automatically. Thus, you should change it manually.After matching their version, it will work.

Ex: When I tried to install Django3, I got same error. I noticed that my PATH still seems C:\python27\Scripts though I already install Python3.8, so that I manually edited my PATH C:\python38\Scripts and reinstalled pip install Django and everything worked well.

Voontent
  • 489
  • 4
  • 6