28

After following this article: How do I install pip on Windows? on my Windows system using Enthought Canopy 64 Bit system, I cannot get pip or easy_install to work due to error:

pip install requests
failed to create process

I tried re-installing setuptools, running cmd prompt as admin without any effect.

Community
  • 1
  • 1
Matt
  • 2,289
  • 6
  • 29
  • 45

14 Answers14

21

When I encountered this, it was because I'd manually renamed the directory python was in. This meant that both setuptools and pip had to be reinstalled. Or, I had to manually rename the python directory to what it had been previously.

410 gone
  • 782
  • 14
  • 25
  • 1
    Thanks EnergyNumbers but that was not my problem. In the end, I resolved this by complete reinstallation of Canopy on my system. I think the problem was that pip was installed outside virtualenv of Canopy python. – Matt Jul 15 '13 at 15:20
  • 4
    This happened when I had a space in my installation path for python on windows. I resolved it by calling `python "path to pip.exe" ` which worked since python.exe was in the path and the path to pip was quoted – bradvido Jun 20 '14 at 14:27
  • 3
    Another reason might be that you've renamed your python.exe (to python2.exe for example). Create a copy of python2.exe and name that python.exe, as long as python3 is earlier on the path that will be invoked, and the pip2.exe will still find the correct .exe in it's parent path. – MatsLindh Jul 02 '14 at 21:54
  • I have this problem but I have not renamed anything, do not have spaces in my installation path and I am not using Canopy – Hack-R Jan 20 '15 at 18:51
  • Happened to me, because, I rename python in miniconda 2 and 3 to python2 and python3. brought them to original condition. And it worked. – Jasim Khan Afridi Oct 28 '16 at 09:47
17

It will help after changing the PATH to python in environment variables:

python -m pip install --upgrade pip --force-reinstall

logical8
  • 1,092
  • 9
  • 12
12

Just ran into this. Sort of. Pip worked for me, but after installing pytest-watch, running the ptw script was giving this error.

For some reason, pip stopped quoting the #! in ptw-script.py:

#!C:\Program Files (x86)\Python\python.exe

It worked after I added quotes manually:

#!"C:\Program Files (x86)\Python\python.exe"

I don't really know why this suddenly started happening. Adding this here in case anyone else coming here from Google runs into the same thing.

Here's a related pip issue (I think).

Joe
  • 16,328
  • 12
  • 61
  • 75
  • 1
    I had the same problem with the elastic beanstalk CLI script, applied fix and now works. Thanks! – doogle Nov 06 '15 at 19:13
  • 1
    @Joe, adding quotes as you mentioned fixed the failed-to-create-process issues with autopep8. Thanks a lot! – Barn Monkey Jan 02 '16 at 13:50
9

If you intentionally want to rename the folder where python.exe resides, you should also modify all python files in the Scripts folder. So a third solution would be to modify the python files as well: the first line in pip-2.7-script.py originally contain:

#!C:\OriginalPythonDir\python.exe

Modifying this path to the new Python folder fixes the problem.

(P.S. Unfortunately I cannot yet reply to answers, so I'll reply as a new answer because I thought it could be useful for other people as well).

mfiers
  • 389
  • 3
  • 7
5

To fix this error (after you change the folder where python is installed) run force-reinstall for pip and pyinstaller, like this:

python -m pip install --upgrade pip --force-reinstall

python -m pip install --upgrade pyinstaller --force-reinstall
Teo
  • 91
  • 1
  • 5
3

I ran into this bug while installing an older version of Python (3.5.2) for compatibility with some aws-adfs scripting. I installed aws-adfs with pip, on Windows 10, and found that while Python is installed to a directory path with spaces in it you will get the failed to create process error.

The pip maintainers say that it was a deeper problem with setuptools and even offered a workaround if you want to patch the installation in place.

But another, easier solution if you're working with older versions of Python is just to reinstall Python to a directory without spaces.

worc
  • 3,654
  • 3
  • 31
  • 35
3

Test this. it's worked correctly for me:

python -m pip install --upgrade pip --force-reinstall

M Sadra
  • 31
  • 2
2

When I came across this problem, I found that my path contained multiple entries for Python. After tidying up my path so that it had an entry for the python installation folder and the scripts folder (in my case C:\Python27 and C:\Python27\Scripts), pip worked properly.

Mike P
  • 742
  • 11
  • 26
1

I just use python in the command shell on Windows 7 and had this problem immediately after installing pip. In case the above solutions don't help you, you should check that the folder that pip.exe is installed in (in my case, the Script folder under Python32) is in the Path.

0

I had installed Anaconda and so I still had C:\Python27 along with C:\Anaconda in my path. When I removed C:\Python27 and all subfolders I was able to use pip again.

neeljpatel
  • 65
  • 3
0

Please check out have you ever rename your python.exe I install python2 and python3 on my PC at the same time , so I rename my python.exe to python3.exe.And when I use pip ,it boom... After rename it back .It's ok again....

wang xu
  • 3
  • 2
0

Running command prompt with administrator privileges worked for me.

Ramandeep Singh
  • 552
  • 6
  • 11
0

I had the same problem and none of the above worked for me. I deleted my venv. And created a new one by specifying the python path:

virtualenv --python C:\Path\To\Python\python.exe venv
.\venv\Scripts\activate

and this worked

-1

Check whether the pip-script points out the exact location of python.exe, because pip always points (C:\python3.3\python.exe). In my system i've installed 2 versions of python i.e python2 & python3. I ve modified the home application of python.exe into python2.exe and python3.exe.

When i installed pip windows installer. it results me out with the error " failed to create process"