question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip install -U does not remember whether a package was installed with --user

See original GitHub issue

If you do

pip install --user dist
pip install -U dist

then the upgrade will uninstall the original installation from the user site-packages and install the upgraded version in the system site-packages. It should not do this, but rather should remember where the package being upgraded was located, and reinstall to the same location.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:2
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
pradyunsgcommented, May 10, 2016

Ohk. 💡 There seems to be consensus on that behavior them. I have an idea/proposal…

AFAIK, there are 3 possible schemes for packages:

  • “system” - for system/global packages (--system)
  • “user” - for packages installed in user space (--user)
  • “local” - for virtualenv packages (--local)

pip enforces a “working” scheme on every run. Outside a virtualenv, the default working scheme would be “system” (It should really be “user”, that’s another issue #1668). Inside a virtualenv, the default working scheme should be “local”. Passing --system or --user or --local overrides the working scheme.

Only packages in the same scheme as the working scheme can be modified. By modifying, I mean installing or uninstalling a package. Trying to modify a package in a different scheme is not allowed and pip would print a message and error out.

So, modifying a package in system scheme with a “user” working scheme is not allowed. Nor is modifing a package in user scheme with a “system” working scheme. Niether are the other permutations with “local”.

I think this results in a pretty simple behaviour model.

Any comments?

(editted)

1reaction
piotr-dobrogostcommented, May 9, 2016

It’s not so clear this is a user mistake. Why does pip uninstall package installed using user scheme during pip install -U dist while there’s no --user option given? This is very bad UX. The only sane behavior would be to operate on packages installed in user scheme only if --user was passed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip installs packages successfully, but executables not found ...
I know the question asks about macOS, but here is a solution for Linux users who arrive here via Google. I was having...
Read more >
Pip: Installing Python Packages
Pip is a special program used to install Python packages to your system. ... If you have only one version of Python installed...
Read more >
Pip Install: Install and Remove Python Packages
First things first: we need to install pip itself. The good news is that Pip is probably already present on your system. Most...
Read more >
How to install modules with PIP (and fix it when it fails) - Medium
First make sure that you have installed Python. Assuming that, the first thing to do is to check if the module exists. The...
Read more >
How to Install and What is Python Pip? - DataCamp
If the package you are looking to use is already installed but simply out of date. You can update the package in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found