-
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 install --user misbehaves inside venv #5702
Comments
Geepers, I didn't know what the heck was going on until I just found this bug! Seems a serious bug. Also on Arch with Python 3.7. |
Given the confirmation from another user and the obvious severity of the bug, I've marked this as a blocker for 18.1; even though it's ~2 months away. :P |
BTW, the bug happens with both pip versions 10.0.1 and 18.0 for me. |
Great; thanks for checking that @bulletmark! :) |
@raffomania @bulletmark am I understanding correctly that you expect pip to ignore the |
@pradyunsg yeah that's what I would expect |
Erroring out is the plan described in issue #4575 "Adopting "working" scheme for every run":
|
The issue of this bug is not to do with explicit specification of Whether pip errors out on an explicit It is arguably a design error that by default pip installs globally (see the long running and still open debate in issue #1668) so many users just set the user default in their config and forget about it, like I did a month or so ago then scratched my head for ages why my next virtualenv was not getting set up correctly. |
This is duplicate of issue #4141 (Behavior of --user in virtualenv), which mentions error message shown also by @pradyunsg in his comment. It's strange OP did not get this error. Different behavior based on where an option was specified (configuration file vs command line) would be very odd. |
@piotr-dobrogost Agreed. I'd be against having behaviour differ based on where the user specifies I understand that people see setting
And that's the problem - setting Having user installs be the default is what #1668 is about, and discussions about that should take place over there. |
@pfmoore, so you are happy with the current situation that if you set |
@piotr-dobrogost, as I said (my paragraph 2) that is a less important issue. I'd also be happy if that case just reported an error to the user. The important issue is my paragraphs 1 and 3. |
@piotr-dobrogost Good point. See my comment on #4575 - there's a need for a " @bulletmark No, I'm not happy with the current situation[1], but I don't agree that the correct fix is to break the current behaviour that specifying options in the config file works exactly the same as specifying them on the command line. [1] Actually, on a personal basis, I am perfectly happy with the current situation, as I don't specify |
For the non-usability in a venv, I think it's reasonable to modify the message to say that "if you've modified configuration files to include user = true, put user = false in your virtualenv config file". That's a workaround at best but I think it's the least effort change. IMO the bug here is that isn't pip printing the error message, i.e. treating the value set in a configuration file differently from a CLI option. That's a severe bug, as it's (silently) breaking the isolation of the virtualenv. Other than that, the rest of the discussion here is either related to user-by-default (#1668) or related to mixing of schemes (#4575). Let's keep have those discussions there. |
Could someone provide clearer instructions to reproduce this issue? |
Pip should not be used globally but since user mode is not the default (as per #1668) people want to set the user option in their |
Dropping this from 18.1, since this is not something introduced in 18.0 and there's no clear plan on how to fix this within pip anyway. |
I have run into this issue with pip 19.0.3 and 19.2.2. Spent the whole day trying to figure out why packages do not get installed while in the virtual environment. It is a pity that such important issues are not fixed. I think we need another PEP for this situation... :( |
Reiterating what I said 11 months ago.
We don’t need a PEP here. We need someone to explain how to reproduce this issue, so that someone can debug it. Packaging PEPs are needed for issues that affect multiple tools, and a broader design discussion is needed about interoperability. |
Does the following serve as a demonstration?
conclusion: as expected, the package tabulate was installed in the virtual environment
Lets do some testing
Conclusion: the package was successfully installed into user space without explicitly giving
At this point one could run
but i am not doing it, because it fucks up The question is why Next we check if tabulate (installed in step 4 in user space) is available:
Conclusion: as expected, virtual environment isolates current project from user space. And finally the painful part.
Weird message 'Cache entry deserialization failed, entry ignored'. Heh.
It smells bad. Lets continue the journey. Installing tabulate library also drops a command line tool. It should be in the environment bin
Lets look at the script more closely:
This is weird! Shebang is environment-specific but the script is in user space. Something is wrong here. And the last chance. Try loading the library we (think we) have just installed.
hmmm. It is not available in the environment.
Sorry for the long read. |
Thanks, that makes things much clearer. To summarise, Your example didn't explicitly demonstrate using an explicit The fix for the underlying problem is under discussion in #4575. The fact that there's no |
yes. this is what happens. I would be almost happy if the documentation of |
Thank you for that! It helps a lot! --user is supposed to abort when installing from within an activated virtualenv. That seems to not be happening. I'll look into why that's happening and print an error message instead of doing the wrong thing. |
Is this venv specific or does this also happen with virtualenv? |
Okay, this is Basically, pip was never updated to also look at PEP 405's system-site-packages mechanism. I'll file a PR to fix this in a bit. FWIW, it's a matter of updating the function |
^ #7155 filed for fixing this issue. If someone could try it out and let me know if that works well for them, that'll be great! I'd like to avoid fighting our test suite if that change isn't sufficient. |
With #7155, |
Awesome! Thanks for the confirmation @jonathonf! Now, I need to figure out how to fix our build isolation test. :) |
Expect a release in Jan 2020 with this fix. Thanks everyone for your patience around this. This fix was "deep in the weeds" and hits a bunch of edge cases w.r.t. how the development workflow of pip works. :) |
Environment
Description
When using
pip install --user
inside a venv (created using the venv module coming with python), packages get installed in my ~/.local folder instead of the venv.My pip.conf usually sets this flag per default, since I don't install packages globally. This bug makes that config option unusable.
Expected behavior
I would expect
venv/bin/pip list
to include theipdb
package. Instead, the package is installed outside of the venv.How to Reproduce
Output
The text was updated successfully, but these errors were encountered: