-
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
Fix "Permission denied"/"Access refused" error when installing or updating packages (solves #9527, #9566, #9395) #10454
Conversation
Hi @baterflyrity, before going ahead, I recommend you to create a news file for your pull request (in this case, it should be https://pip.pypa.io/en/latest/development/contributing/#news-entries |
Clear user site installation error message.
Describe bug fix.
@DiddiLeija , done. |
Also notice that this fix just prevents destroying of packages instead of installing them. To install write protected packages one is considered to use sudo/gsudo/administrator shell. |
From my reading of this PR, it handles one specific case of permission problems, where
This comes down to improving the error when pip has no actual way of performing an install. That's a worthy improvement, but it's not at all clear to me that it's the root of all the linked issues. Can you please:
|
You keep stating this, but I don't see why it would do so. All this PR does is check if site-packages is writeable before falling back to doing a site install. But if pip tries to install to something that's not writeable, it will just fail, not "destroy packages". The reality here is, I think, that
If you have a reproducible example of pip "destroying packages", please provide instructions so that the pip maintainers can reproduce the problem. Just saying "upgrade pip and it fails, see my output here" is no help. I upgrade pip using itself regularly, and it always works. So there's something else involved, and you haven't yet told me what... |
@pfmoore , just to be clear, real problem is here: # If user installs are not enabled, choose a non-user install
if not site.ENABLE_USER_SITE:
logger.debug("Non-user install because user site-packages disabled")
return False # ←←←←←←←← no check of write access at all Hence we want to e.g. upgrade global package pylint ( Thus i added this check here plus do small refactoring to reduce code amount (combined two cases). The old logic was:
and the new one is:
p.s.
|
That's not what the check
That's a github question, I don't think they support that.
I don't. I use it (as it's documented) all the time.
sudo isn't a Windows command, and every Unix distro strongly discourages using
That command isn't supported, and the documented We're getting nowhere here, you are just repeating the same statements without adding anything new, I'm afraid :-(
Tell me exactly what I need to do in order to step by step generate the error you are seeing.
🤷 If that's the easiest way for you to give me precise instructions, then sure. But it's not necessary - all that's necessary is you tell me what you do. So far all you've said is
OK, that's fine. Just remove the claims that this PR fixes issues that you haven't confirmed it fixes, to avoid confusing people. |
Is |
Or is this not on Windows? |
It's not at all clear to me what system this is on (the OP quoted sudo at one point). Other posts by @baterflyrity have output quoted that seems to suggest that maybe they are using a mingw64 or msys2 environment, which would be another possibility for something different - the mingw64/msys2 builds of Python are customised and not supported by python.org, so if the problem only occurs with those distributions, it needs to be raised with that project. @baterflyrity these are the sorts of questions you need to address in providing a reproducible set of instructions for demonstrating the issue. |
@pfmoore ,
# ...
# If we are here, user installs have not been explicitly requested/avoided
assert use_user_site is None
# user install incompatible with --prefix/--target
if prefix_path or target_dir:
logger.debug("Non-user install due to --prefix or --target option")
return False
# here comes my patch... |
@pfmoore , @pradyunsg , windows 10. It's special program called gsudo to grant admin access in the current session. Simple python3.9 installation with the official installer. |
See here. That check says "if the Python interpreter does not have the user site location enabled". That's almost never the case in real systems, and nothing in any of the examples you've given suggests you're configuring things that way. Moving a block of code that will never be executed in a particular situation will make no difference. Your PR only changes pip's behaviour if |
pfmoore wrote:
Please note that in the case of my #9395 (venv on different volume from %TEMP%) it does indeed "destroy pip". |
Yes, that's a different situation (and thanks for your clear explanation over there of what the issue is that you're encountering). |
@pfmoore well... i disagree with you that this is useless PR as far as it corrects logical error (see logical scheme above) anyway. So lets firstly review this as "add global installation write access check". Oppositely, i think relatively to #9527, #9566, #9395 i need to go deeper, open IDE, write some tests and even use debugger) But it need much more time then editing text in browser. Also tell me please where can i find pip's logs. |
Add check for write permissions for non user installs.