There is a problem when trying to run pip.exe when the path of Python installation contain spaces. Some launcher code adds extra quotes, which results in incorrect path and results in fatal error in launcher. See for example http://stackoverflow.com/questions/24627525/fatal-error-in-launcher-unable-to-create-process-using-c-program-files-x86. I understand that this is probably issue of the code producing the launcher (there is the same problem with IPython launcher), but I'm not sure where to report it.
Hi, I managed to solve the issue by removing the quotes in the "ScriptMaker" used to generate the exe launchers.
As an alternative using short paths works as well (Windows paths have always their 8.3 counterpart, e.g.: "C:\progra~1" for "C:\Program Files", as this avoids the need for quotes
The problem is that Python is not working well when reading paths with quotes in the "shebang" section of the exe launchers.
Here's the proof of concept:
import os
import sys
from pip._vendor.distlib import scripts
specs = 'nova = novaclient.shell:main'
scripts_path = os.path.join(os.path.dirname(sys.executable), 'Scripts')
m = scripts.ScriptMaker(None, scripts_path)
# This is e.g.: "C:\program Files\blah\blah\Python.exe"
m.executable = sys.executable
m.make(specs)
I have a feeling this was fixed recently in distlib, and vendored into pip. Could you check if the issue still exists with the development version of pip from github?
Did some quick tests and it worked. Closing the pull request by now, I'll investigate further and reopen it in case.
Thanks!
Did some further investigations, the issue was in the "t32.exe" launcher and has been fixed by this patch in distlib:
IMO the issue can be considered closed.
Still experiencing the problem when my pip had no spaces:
$ pip install --upgrade spyder
Fatal error in launcher: Unable to create process using '"C:\Python34\python.exe" "c:\Python34\Scripts\pip.exe" install --upgrade spyder'
Comfirmed this on Windows 7 with Python 3.5.
My pip is in C:\Python3\Scripts\
, no space.
@laike9m could you describe the exact error you're getting?
C:\Users\dell>pip freeze
Fatal error in launcher: Unable to create process using '“‘
Confirmed for Windows 10 as well. No spaces.
I am running it within a virtual environment, but that shouldn't be an issue.
Fatal error in launcher: Unable to create process using '"'
Same here and no virtual environment, windows 8.1
Both with python 3.5 and python 3.4 annaconda based distribution.
[edit] my path was polluted by a python version which was not properly uninstalled. It works with pyton3.4 anaconda
pip PIP_FIND_LINKS env variable dosen't support the windows space, and it resulted in a virtualenv bugs. Because virtualenv can't install setuptools, wheel through the pip installed in C:/Program files/Python27 when I create an virtual evironment.
I think pip should support the double " , like windows cmd, such as
"C:\Program files\python27\" (" is in the string) when you parse the PIP_FIND_LINKS.
And use the space to split PIP_FIND_LINKS into different paths which is not a good choice.
Just found this workaround http://stackoverflow.com/a/26428562/670565 hope it will be useful to someone :+1:
It's not only workaround. Sometimes it's preferred to call pip using py -m pip
, e.g. you can easily specify which version of Python installed you want to handle.
Same shiat here when installing python with chocolatey.
Here's output in cmder after choco install python
:
C:\Users\My Name
λ python --version
Python 3.5.1
C:\Users\My Name
λ pip --version
Fatal error in launcher: Unable to create process using '"'
C:\Users\My Name
λ which pip
/c/Users/My Name/AppData/Local/Programs/Python/Python35-32/Scripts/pip
A workaround for this issue is overriding --installargs (short -ia):
choco install python3 -y -o -ia "/quiet InstallAllUsers=1 TargetDir=c:\Python35"
Windows 10, x86. I also have Python 3.5.1 (local user install, username does not have spaces in path), it had pip 7.1.2, which had this problem.
Running: python -m pip install -U pip
resulted in pip 8.1.2 being installed, which doesn't have this problem.
Once I upgraded to pip 8.1.2, I was able to run:
pip install --upgrade spyder
without issue (it installed 2.3.9).
This issue's summary is pretty vague (it's missing "what's wrong"), the long description points to a stackoverflow question with a bunch of things. I'd suggest a maintainer clarify this issue summary to be limited to a single problem. If that problem is pip 7.1.2 and below yielding:
Fatal error in launcher: Unable to create process using '"'
when people try to run pip
, then this issue should be resolved as fixed. If it's something else, then at least people will know it isn't that issue (which is fixed...).
Closing this, I can't reproduce this. If you're still having issues please open a new issue with reproduction steps. It appears this was fixed in distlib.
Steps to reproduce:
That's it reproduced
Most helpful comment
Just found this workaround http://stackoverflow.com/a/26428562/670565 hope it will be useful to someone :+1: