-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removal of escaping in shebang in pip install causes "failed to create process" on Windows #398
Comments
Original comment by joeyespo (Bitbucket: joeyespo, GitHub: joeyespo): I'm not sure if this is a good idea or not, but one way to fix this without involving escaping would be to use Details: http://stackoverflow.com/questions/23598289/how-to-get-windows-short-file-name-in-python |
Original comment by johnthagen (Bitbucket: johnthagen, GitHub: johnthagen): Just wanted to add that this problem manifests itself in a slightly different way when Python 3.5 is installed by default on Windows. If the user has a space in their name (e.g. John Doe), then this problem arises and is very difficult to debug. Example path:
|
Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco): Before I switched to OS X in May, I ran Windows almost exclusively, but I didn't encounter this issue because I used Still, I would not expect this issue to arise even without that setting as the script generation is specifically special-cased for Windows. I'll take a quick look to see if I can replicate the issue. |
Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco): I'm not able to replicate the issue simply. Here's my install of setuptools on Python 3.5 in a directory with spaces and evidence that the script shebang includes quotes:
Can someone whose environment has this issue what shebang appears when installing setuptools itself? If it doesn't include the quotes, can you trace the code to determine what in your environment might differ from mine? Or alternately, how can I configure my environment to replicate the behavior you see? |
Original comment by johnthagen (Bitbucket: johnthagen, GitHub: johnthagen): @jaraco I have been able to reproduce the error with the following steps on two Windows 10 x64 machines and a Windows 10 x64 VM.
Note that what is actually failing here is the If you |
Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco): Aha. In that case, the issue lies with pip and distlib. I'm not sure whether to file the issue with the former or the latter, but I'd start with the former, as you're using pip, so the issue applies to it, and if an upstream bug needs to be filed with distlib, the pip team can advise. |
See |
I did some digging into this issue; it's either a setuptools or distutils problem. I'll stick to cpplint, but any package using setuptools and entry points should show this behaviour. Things I have observed:
I don't know what the egg installation code does different, but in setuptools/command/install_scripts.py line 33
Then, Wrapping |
You're right, it's a setuptools issue, not pip or distlib. When installing from a binary wheel (or when installing from sdist package), pip uses distlib to create the console/gui scripts, and distlib does take care of "enquoting" the executable in the shebang: https://github.com/pypa/pip/blob/master/pip/_vendor/distlib/scripts.py#L161-L164 I think it's in |
I confirm what @fkrull just said. The executable string from distutils Passing Thanks for finding this out! 👍 |
Originally reported by: joeyespo (Bitbucket: joeyespo, GitHub: joeyespo)
I have Python installed in
C:\Program Files (x86)\Python
(for legacy reasons--it's kind of late to move it now), and anyconsole_script
I install from PyPI breaks now. Running the script causes a "failed to create process" error.I noticed that older console_scripts were working, and turns out it's because they were quoted. Ex:
#!"C:\Program Files (x86)\Python\python.exe"
Manually adding quotes around the newly installed
projectname-script.py
fixes it.It looks like the culprit may have been the fix in #188. From that issue:
Turns out skipping escaping all together just threw the problem back over the fence to Windows. Perhaps it'd be best to detect the platform? Escaping is indeed a platform-specific thing.
The text was updated successfully, but these errors were encountered: