-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Spaces in Python path make pip-installed launchers fail on Windows #2783
Comments
The error message is different. See issue number 1997 and 1999 (linked above) for the bug related to that SO-thread (which IIUC was was fixed by new In this case, the pip seems to write a non-executable shebang line (in contrast to |
Note that this only happens with As 7.0 switched to building wheels for sdists, one now needs |
Edit: Want to point out this was run under Windows 10.
Related stackoverflow posts: |
The issue here appears to be the same as one I've experienced with pip 1.5.4 on OS X 10.9.5. It is not a Windows bug per se. The "shebang" line (hash-bang, or #!) specifying the interpreter to use must not contain a space. The workaround might be to create a symlink which doesn't have a space in the path. Sadly, the issue is not trivially remediable by mere quoting. See the attached tarball if you want a demo (read the README) or see https://lists.gnu.org/archive/html/bug-bash/2008-05/msg00053.html Edit: as Janzert indicates below, the problem I reproduce appears not to be related to the Windows problem of the instant issue. This comment pertains to UNIX-like OS. Same symptom with different causes -- leaving this comment above intact to help future readers disambiguate where to be spending time. |
Remember Windows itself doesn't do anything with shebang lines. So it is handled by the launcher executable from distlib directly. A quick skim of the launcher source seems to show that it does explicitly and correctly handle double quotes around the interpreter command. |
I have a workaround. I encountered the same problem in my pandoc-eqnos project. See Issue #6. It occurs on Windows 10 installations, but not 7. I haven't tested 8. As others have said: A I implemented the workaround in my |
Here is the code for the workaround. You can copy this into your setup.py and enable it by hooking
|
Just wanted to confirm @tomduck's findings about Windows 10. The problem I wrote about above was manifest in Windows 10 (I just assumed it affected 7 and 8 as well). For reference, here is a corresponding (now closed) |
My own digging found that the problem is not with pip directly, but with |
BUMP! |
FYI: The fix for the underlying setuptools issue (pypa/setuptools#398) is now merged there. |
I experienced the problem under Win 7. But I have a new workaround (althought I don't understand exactly) But when I start a normal console ("cmd" in the start menu) then I get the
(and I tried to put the folder with space in the PATH, I still get the same error) So I don't know what the "powershell" does, but it solve the problem. |
This appears to be an issue with setuptools and not with pip itself. Closing this as upgrading the version of setuptools seems to be the right answer. |
Launchers (
console_scripts
) installed via pip under Windows fail when Python is installed in a path that contains spaces (e.g.C:\Program Files (x86)\...
, which will be the default directory for 3.5):It does work, when the package is installed manually via
python setup.py install
. Also, both ways install the same<packagename>.exe
launcher (so this is different from #1997 and #1999).Via
pip install
, the shebang in<packagename>-script.py
is#!C:\Program Files (x86)\Python27\python.exe
instead of (via
python setup.py install
)#!"C:\Program Files (x86)\Python27\python.exe"
Note that both launcher scripts actually work when executed directly: only the launcher
.exe
seems to be more strict about quoting. So it may be good to (also) make the launcher more forgiving (is the bug tracker for distlib non-public?).The text was updated successfully, but these errors were encountered: