1

I am puzzled by the following behavior. I have Python 3.4 installed on Windows 7. Pip came installed with the Windows distribution.
When I try to install virtualenv (or any other package), or execute any other command, nothing happens:

C:\Python34\pip install virtualenv
(nothing happens)
C:\Python34\pip list
(nothing happens)

However, the python -m variants do work.

C:\Python34\python -m pip install virtual env
C:\Python34\python -m pip list

I know that the Python Packaging User Guide, in the section Installing Packages says to use python -m pip install [package name]. However, should 'pip install [package name]' also work?
I found in a previous post that they do the same things, so why is there a difference in behavior?

Community
  • 1
  • 1
3bek
  • 106
  • 1
  • 5
  • My problem sounds similar to this one reported here: [link](http://stackoverflow.com/questions/33634318) – 3bek Jan 12 '16 at 21:42
  • And the same as issue [33724228](http://stackoverflow.com/questions/33724228/). There, also the workaround was python -m, but no root cause found... – 3bek Jan 13 '16 at 11:10

2 Answers2

1

pip is installed into Scripts subdir.

Try C:\Python34\Scripts\pip -V to see what you are running.

C:\>C:\Python34\Scripts\pip -V
pip 7.1.2 from C:\Python34\lib\site-packages (python 3.4)

Otherwise your pip.exe process might be blocked by the running antivirus.

Adaephon
  • 16,929
  • 1
  • 54
  • 71
Radek
  • 1,530
  • 16
  • 20
  • When I do that, the same happens as with the other pip commands: nothing happens, it seems like the program hangs. In the Windows Task Manager, strangely enough, I see 3 pip.exe processes. All of them using 0 CPU and very little memory. – 3bek Jan 11 '16 at 21:38
  • I can only guess that your pip.exe process is blocked by the running antivirus. – Radek Jan 12 '16 at 22:09
  • You were spot on! I inactivated my antivirus (Avast Free Antivirus). And now pip is working. I didn't expect that. Thanks. Now I will see how I can explain Avast to stop bugging me. Thanks! – 3bek Jan 14 '16 at 21:26
  • Removal? :) I am glad it helped. Updated the answer for others to help. – Radek Jan 14 '16 at 23:02
0

(Building on Radek's answer) There are two problems with using pip (and similar scripts in Scripts). The first is enabling the OS to find the file. You must either give the correct absolute path or .../Pythonxy/Scripts must be on the PATH. I believe making the latter true is optional when installing.

If you actually entered what you posted, I am surprised that Windows did not respond with the Win 7 version of "c:\programs\python35\pip is not recognized as an internal or external command, operable program or batch file." (from my Win 10 machine).

The second, when more than one version of Python is installed, is the ambiguity of which pip to run (with which python binary). Even if all Python installations have the same pip version, it must be run with the version whose site-packages directory is the intended target. Even when pip install xyz at the command line runs, it may or may not do what is intended.

The dependable solution to both issues is to specify a particular python binary (whether with .../python.exe, python, python2, python3, or py -x.y, and let that binary find 'its' pip and point it to the 'right' site-packages.

Tom Fuller
  • 5,291
  • 7
  • 33
  • 42
Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
  • The directory, is in my PATH environment. When do echo %PATH%, I get C:\Python34\;C\Python34\Scripts\; ... . So that seems fine. – 3bek Jan 11 '16 at 21:39