pip: pip does not support spaces in directories names
under Mac OS X 10.7
tareks:tmp tarek$ mkdir "some space"
tareks:tmp tarek$ cd some\ space/
tareks:some space tarek$ virtualenv --no-site-packages .
The --no-site-packages flag is deprecated; it is now the default behavior.
New python executable in ./bin/python
Installing setuptools............done.
Installing pip...............done.
tareks:some space tarek$ bin/pip install docutils
-bash: bin/pip: "/private/tmp/some: bad interpreter: No such file or directory
Or maybe that’s virtualenv ?
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 6
- Comments: 46 (31 by maintainers)
Links to this issue
Commits related to this issue
- update instructions to fix a problem with virtualenv https://github.com/pypa/pip/issues/923#issuecomment-33002478 — committed to transitland/transitland-processing-animation by willgeary 7 years ago
For folks looking for a simpler solution, I got https://github.com/pypa/pip/issues/923#issuecomment-19655227 to work pretty well, in a simpler mode. I only ever needed to call pip once (during an install script), so instead of saying
I did
Solved my my problem - still a challenge to call pip outside of the script, but the incision is more narrow.
I’m not really into Python and this just confirmed I don’t want to be. It’s taken 4 years to add support for a space, and only to some platforms.
Thanks for the release @vsajip!
This fix will be shipping as a part of pip 10.
I have this problem on Windows 7 and quoting the path in the shebang line does not help. I find it pretty shocking that in 2017 we still develop software that falls flat on its face when encountering a space.
@smoothmango Would another option be to run
python -m pip
(orpython3 -m pip
) rather thanpip
?Seems to be one way the docs specify to run it: https://pip.pypa.io/en/stable/installing/#upgrading-pip
That works well. ^.^
FTR - I just ran the test-suite of pip after vendoring the latest
distlib
and all tests passed.I guess that means this would be shipping as a part of pip 10 – adding to the milestone. 😃
When time allows, so it might be sometime in early September. There are a couple of
distlib
issues I’m working on and would like to resolve before the next release.N.B. recent updates of
distlib
(not yet released, but available in the source repository) use special mechanisms to specify very long paths or paths with spaces in scripts installed usingScriptMaker
. It might be worth testing this withpip
.Just to quote myself here…
I find it pretty shocking that after decades of agony developers still use spaces in paths and expect it to work 😃
This is a long standing issue with many facets. The person who fixes it upstream will be revered and adored like no other, maybe something is happening already?
I’m highly interested in complicated path support so I give it a try. Here are my steps on Arch Linux and MacPorts, hoping that helps others.
Now we can use the modified virtualenv package:
I just got bit by this. Unfortunately, quoting in spaces nor escaping with backslashes fixes the problem.
I am incredibly dismayed to find that OS X does not support a shebang with spaces in the interpreter path! Gah!
I had to come up with an incredibly lame hack:
cd virtualenv/bin mv pip .real_pip vim pip
I then populated pip with the following:
#!/bin/bash
“/Users/jpepas/Developer/Peepcode/Meet Jquery/flask/virtualenv/bin/python” “/Users/jpepas/Developer/Peepcode/Meet Jquery/flask/virtualenv/bin/.real_pip” $@
So the only bullet-proof workaround I see is for each of the scripts which use a shebang (for my setup, that’s pip, pip-2.7, easy_install, easy_install-2.7) to be replaced by this level-of-indirection hack.
I feel dirty now.
(update 2017/5/28: just to be clear, my dismay is directed at Apple, this isn’t the virtualenv team’s fault.)