Space in filename in PIP_CONSTRAINTS is interpreted as a new file
See original GitHub issueDescription
The PIP_CONSTRAINTS
variable (and likely any other path related variables?) can’t handle a path with a space in it. Something like PIP_CONSTRAINTS="C:\Program Files\..."
causes Could not open requirements file: [Errno 2] No such file or directory: 'C:\\Program'
. These path variables should probably interpret spaces as part of paths, and use a separator for multiple values (like :
or ;
).
Also, quotes around the path causes this to fail, too, PIP_CONSTRAINTS="'C:\Program Files\...'"
breaks.
See https://github.com/pypa/cibuildwheel/issues/740
Expected behavior
Spaces in paths should not break.
pip version
21.1.3
Python version
All
OS
Windows and macOS, at least, probably all.
How to Reproduce
- Make a constraints file with a space
my constraints.txt
- Then run
PIP_CONSTRAINTS="my constraints.txt" pip install <package>
- An error occurs.
Output
Could not open requirements file: [Errno 2] No such file or directory: 'C:\\Program'`
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
pip3 fails to install python module with space in name from ...
PyPI packages cannot have spaces in the name. There is no package named jupyter qtconsole , and no way to search for one...
Read more >Requirements File Format - pip documentation v22.3.1
Requirements files serve as a list of items to be installed by pip, when using pip install. Files that use this format are...
Read more >User Guide — pip 10.0.0.dev0 documentation
Constraints files are requirements files that only control which version of a requirement is installed, not whether it is installed or not. Their...
Read more >Pip constraints files - Blog | luminousmen
In python, it is common practice to write all the application dependencies that are installed via pip into a separate text file.
Read more >pip Documentation - Read the Docs
This means pip works on the latest patch version of each of these minor ... Including a package in a constraints file does...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe since 10.0 the
:
path separator is purely cosmetic on macOS; it always stores paths with/
, and only transforms it to:
when showing it in GUI. So as far as Python code (which is run in POSIX mode) is concerned, we can useos.pathsep
without issues.But there are two major downsides here. First, this means the accepted values on POSIX and Windows will be different (
os.pathsep
is;
on Windows), which will cause user confusion. Another is that most of pip’s path arguments are actually path-or-URL (includingPIP_CONSTRAINT
!) and obviously you’re going you run into issues parsing/a/local/path:https://rawgithubcontent.com/pypa/pip/requirements.txt
. So I think the quoting + space solution is the way to go if we want to do this.Ah, I didn’t know MacOS did that. Cross-platform rules are weird 🙂