-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Requirements file which contains -e
with a relative local path, is only installable from a specific directory
#6112
Comments
I wonder how this could be rolled out if people are relying on the |
Thanks (again!) for looking up the duplicate issue that would have been difficult to find otherwise @piotr-dobrogost! :) @cjerdonek I agree with the closing comment on #3772 that this should be handled in Requirements 2.0. |
@cjerdonek Good point. In order keep backward compatibly there would have to be a hint to distinguish the 2 cases. The only ideas that come to mind are having a distinguishable syntax in the requirements.txt or in the command line flag. I have to admit I'm not a big fan of either solution. @pradyunsg By requirements 2.0 do you mean Pipfile ? |
@Thiel Yes. That's what it has become now. :) |
We could use a / like .gitignore and .gitattributes do to indicate a path relative to the repository root, or some other symbol like that. So ../other/requirements.txt would still go wherever it goes today. But /my/other/requirements.txt would go to the same file no matter which directory I attempted to install it from. |
Since
|
Yes I think that’s a good idea and would approve a PR adding it. (The variable name needs some discussion since |
Alternatively we could transition to making all relative paths in requirement files to be relative to the requirement file itself instead of the current working directory - which is a surprising behaviour, especially when you have nested requirement files. That is a breaking change, which would need to be weighted carefully, of course. |
Any suggestions for a better variable name? |
|
The variable should make sense for non-editable requirements as well so having |
That's what
|
Yes |
Since the requirements file doesn't need to be named As a comparison, CMake uses |
@TBBle for what it's worth, I like this idea. Sometimes I install multiple requirements files (that aren't even called |
I second the suggestion to create a git/VCS-root environment variable. My use case is as follows:
Of course, there is a simple workaround in my case (since CI always does pip install from the module root, just change the requirements file to |
Environment
Description
I would like to be able to call
pip install -r path/to/requirements.txt
from any directory. However usage of--editable
/-e
with a relative path inside of a requirements.txt assume that the path is relative the current directory I'm currently in, rather than the directory where the file is located.My specific use case, involve usage of multiple independent requirements.txt in a directory hierarchy where they can reference each other. And seems to exhibit the same issue.
Expected behavior
Expected behavior would be to not require being in a specific directory in order to call
pip install -r path/to/requirements.txt
when--editable
/-e
is being used with relative local path.How to Reproduce
Output
Potential solution
I assume that
pip
is missing a chdir when the requirements is being interpreted. And doing so would fix all mentioned issue.Would there be a reason that prevent us to do that?
The text was updated successfully, but these errors were encountered: