-
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
PIP_CONFIG_FILE overrides other configs in conflict with documentation #11815
Comments
Changing the docs to match reality seems like the right thing to do here. Thanks for catching and flagging this. |
I'll try to submit a PR fixing the docs later this week. I think that having the environment variable be the final authority is pretty intuitive and consistent with how Pip and other programs use env vars. That being said I was pulling for this not being the case, since this leaves no mechanism to have a default file that a user can override without root. Maybe I'll open a separate issue to look into creating such a mechanism. |
Another note about docs for pip configuration: as I read: There are four possible places for config files (OS-X example) Global: User: The legacy “per-user” configuration file is also loaded, if it exists: Site: However, there seems to be no way to specify pip configuration in the base Python -- which would be very ueful for, e.g. conda environments. However, in the code: There is code to look in sys.prefix:
Hmm -- looking now, that was added by @pelson on Oct 6, 2022 -- so new -- but there have been three releases since then -- so I think this needs to be added to the docs. |
That's #9752. https://pip.pypa.io/en/latest/topics/configuration/#configuration-files (note latest vs stable, and the docs needs a fix in the version numbers) |
In response to @ChrisBarker-NOAA (hi Chris! 👋): Yes, the change was made in #11487 to include the config from the base environment. The documentation was updated to reflect this change, but it hasn't yet made it into a release (merged in January) - all things being equal, it will be in It doesn't help with At a certain point I wished to be able to override the pip config precedence (think it was discussed in the linked PR), but it was rejected for its complexity and potential impact on system administrators ability to control 👍 to updating the docs to reflect the current behaviour that the environment file is loaded last. |
I agree -- but I think that all the previous configuration options are outside conda environments -- and that this new feature would allow you to have a configuration specific to a particular environment, which is what I'm looking for.
I'm not sure that that would do what I'm looking for, but in any case, this is a topic for conda / conda-forge. pip seems to be in good shape with regard to this once the new docs get published. |
Description
When PIP_CONFIG_FILE is set, values in that file override other files. However in the documentation it states:
I presume that the intended functionality is what is described in the documentation, especially since there is a comment to that effect in
Configuration.iter_config_files
. (Namely,# environment variables have the lowest priority
.) However, given the length of time things have been this way, maybe the docs are what's wrong.The actual functionality is determined by override order, where
kinds.ENV
is the second highest priority. I think having the order specified in two different places is the ultimate source of the bug.Happy to submit a PR once there's some clarity on what the right way to fix it is.
Expected behavior
No response
pip version
all
Python version
3
OS
any
How to Reproduce
Have any (global, user, site) pip.conf in a standard path and run
> PIP_CONFIG_FILE=/path/to/any/other/pip.conf pip config debug
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: