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
Installing from git repo in local directory fails if specified in requirements.txt and path contains spaces #7234
Comments
The handling of quotes when pip is executed directly is governed by your shell. In Bash, for example, non-nested pairs of quotes are stripped and their contents concatenated with what comes before/after to create each argument. Requirements files, on the other hand, are read as-is by optparse and no special quote handling or stripping takes place. That said, in this case when trying to provide a URL, the non-valid URL characters (like space) must be percent-encoded (space is %20). See this script for an example that successfully installs a git repo that had spaces in the path: repro.sh
Output
|
This worked thank you so much!! Do you want to answer the SO question? Otherwise I'm going to quote your explanation as the answer, if you don't mind. I'm going to close this issue, out of curiosity, is this a Windows only issue? Because according to user 00 on SO, it works for him without %20 on Mac. |
I'm glad it helped. :) Please go ahead! I would be a little surprised if the behavior is platform-specific. The code here should be what splits out the URL and I don't see anything that would change across platforms. In any case, percent-encoding should work everywhere out of the box so it's definitely the way to go even for people who may get it working some other way on other platforms. |
Environment
Description
I am able to install a package from a git repo in a local directory as such:
pip install git+file:///"k/my/path with/lots of/spaces/repo/.git/"
However when I put
git+file:///"k/my/path with/lots of/spaces/repo/.git/"
into myrequirements.txt
and then try to install withpip install -r requirements.txt
it fails withValueError: No closing quotation
.Expected behavior
Expected the package to be installed from local directory just as it is when I run the command directly.
How to Reproduce
requirements.txt
pip install -r requirements.txt
Output
requirements.txt
:See also related SO question.
The text was updated successfully, but these errors were encountered: