-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Windows Store installation of Python adds a pip.ini file which configures --user #103646
Comments
When did pip start looking in What's the best way to go back to the old behaviour of only looking in |
And the issue that prompted this option is that Other scenarios also benefit from using Using a different filename for Really, we probably need to get a lot clearer on whether a venv is isolation from the base environment or not. Historically, it's always been isolation as far as configuration goes. Changing that is a big deal. |
Yes, this is new behaviour in pip 23.1 (we added a "base" config location, which uses
There isn't one. I'm planning on reverting this change temporarily while we figure out a better fix, but this was a deliberate change for a particular use case, so something like this will probably get added.
That's perfectly typical, it's how Unix distros work. Pip automatically switches to user installs if site-packages is unwriteable, so this workaround shouldn't be needed (if it is, then that's a pip bug that we'd rather have reported so we can fix it). I don't recall when we added that behaviour - it's possible the store distribution put the config file hack in before then.
We may need to advise users to remove the file manually if they use an upgraded pip, but yes, we can't do much about old releases.
IMO, that's the wrong approach. The systems you mention might need something like this1, but making it a part of the default install is not warranted just because some systems have an issue. Pip's config files are for the user to manage, not for the distribution's use, so letting the users create such a config is fine, but shipping a config with Python isn't.
Agreed. Having some sort of CPython policy on that would be extremely useful. But there's always One further thought - we've had enough trouble with users setting Footnotes
|
The config file is also in the unmodifiable area, so users can't get rid of it. We'd have to make new CPython releases for 3.7+.
To be clear, it's part of the default install for that system. Nobody outside of that system gets the same install (unless they deliberately seek it out). The Store package isn't the package they use - they have their own private build and package of CPython.
The "best" approach not involving pip here is to patch |
Ouch. That seems like a really bad situation, shipping an unmodifiable copy of a configuration file specifically intended for user consumption :-( I guess we could advise users to override the global config in a user config file, but that's going to be less than ideal...
OK, that's fine. For a custom build they can (and should) do what suits their use case. But for a general-purpose build like the Store package, different rules apply (IMO).
Personally, I think that pip's built in behaviour of switching to user installs if site-packages isn't writeable should be sufficient, and we should just remove the config file for all releases that ship with a version of pip recent enough to have that behaviour. Although obviously, I'd advise that we check that the behaviour does work as expected (I don't think anyone has tested it with the Store Python, and if we need to refine the check for writeability we can do that). More generally, I'd rather the user experience with Store Python work more like Linux distros (which have had read-only site-packages for a long time now). So my initial question with any proposal is "do Linux distros do it like this", followed by "why can't you do the same as Linux" if the answer was "no"... |
The Linux distros don't, because they want their user site-packages to be for system packages as well. Plus they have a step where they modify the Python sources before shipping, while we don't. But I think you're right that the writeability check should handle it (assuming you're literally just trying to write a file, and not doing anything more "clever"). When I get my current work cleared, I'll have a look at it. |
Update Ignore what's below, I think setting [Left here as evidence of what I tried, even though it's wrong] Hmm, it looks like the permissions check doesn't work for the Store Python:
I'm not sure why, as pip's
But that's "just" a bug in pip, which we can (and should) solve... |
…build (pythonGH-105064) (cherry picked from commit 6da7015) Co-authored-by: Steve Dower <[email protected]>
…H-105064) (cherry picked from commit 6da7015) Co-authored-by: Steve Dower <[email protected]>
The I suspect there's next-to-no usage of the |
Sounds reasonable to me. I didn't realise the code was used outside of the CPython release process, but yes, if it might be, we should be cautious. |
Bug report
See pypa/pip#11982 for background. Basically, pip added a mechanism for users to configure the "base" (installation-wide) settings. This mechanism picks up a
pip.ini
file that is shipped with the Windows Store installation of Python. The problem is that the shipped config file sets the--user
option globally, meaning that it gets picked up in virtual environments as well, which causes pip to fail.IMO, the pip feature needs reconsidering, to allow for the possibility of something like this, but it's also true that we advise against setting
--user
in configuration files. So I think the Windows Store distribution should consider other mechanisms for handling whatever issue prompted the addition of this config. If that requires changes from pip's side, please reach out - we already have a check if site-packages is writeable and we fall back to--user
if it isn't, so we could definitely consider extending that check.Linked PRs
The text was updated successfully, but these errors were encountered: