-
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
Ignore --user
in virtual environments
#7164
Comments
I've sketched out a related approach in #7002: default to The big advantage my approach has is that it's not virtualenv specific. Pip's virtualenv detection won't notice environments made by conda or pyenv, but I think people expect similar behaviour in all of them. It's treating system Python (with read-only site-packages) as a special case rather than environments. To frame it another way, this is the logic I think makes sense: try:
normal_install()
except PermissionError:
if user_site_enabled:
user_install() |
Yea, I've looked at the approach outlined in #7002 and, on a quick read then and a slightly relaxed read a few minutes ago, and nothing about it immediately raises concerns to me. |
I agree, I've not read #7002 in detail, but in general, I prefer an approach that makes it less necessary to need to specify |
To throw my 0.02 in the hat... I agree with the sentiment that the default should change too but I think it'd be great if that didn't get in the way of the simplicity of this on its own. Muscle memory means I occasionally type Of course making me never need to type it would be great, which lots of us have hoped for for quite a few years now :), but making things not blow up still seems nice and self contained and maybe not take as long / be as contentious :). |
Okay, I slept over this and I think #7002 is a good idea and we should definitely do it. I'm sure there's gonna be edge cases and all, but overall, it should be a much better approach than what I'm proposing here. Also, if we do #7002, then our current behavior for --user in virtualenv makes a lot of sense. We can even update our error messages for that case, to tell the user to remove --user since we're defaulting to it now. |
Basically, I agree with @takluyver that #7002 is a better approach to this overall. :) |
Closing since #7002 has merged. |
@pradyunsg I think this was more to contrast the behavior updated with PR #7155, that is: if That said, the reason that this would happen for users is because they would put |
Yep. I feel this doesn't as much sense if we have saner defaults that work better in this case. Explicit opt-ins shouldn't be needed then, which should make things easier to manage. : ) |
What's the problem this feature will solve?
Ensure that folks who do
pip config set install.user true
can continue using virtual environments without "--user isn't visible, aborting" messages. :)Describe the solution you'd like
--user
does nothing in a virtualenv that does not have system site-packages access.Alternative Solutions
Maintain status quo. Or #7002. Or something else entirely!
Additional context
#4141 (comment) -- some past discussion.
#6984 (comment) -- a proposed way to implement this.
The text was updated successfully, but these errors were encountered: