pypa/pip — pull request #704 by eevee (2012-10-16 23:14:14+00:00)
Title: Fix `pip install --user` when upgrading an existing system package.

I'm on a machine with old system packages and I want to install newer versions in my user-site. Despite all the recent work on `--user`, no combination of `--upgrade` and `--ignore-installed` completed successfully; pip would always try to remove the system package and, naturally, fail.

This is a somewhat dumb patch that fixes the behavior for me. I can't imagine how to write a test for it, and the existing user-site tests confirm this is unsupported, but it's simple enough.

(fwiw, the existing code didn't cover this case because while `check_if_exists` has some `use_user_site` guards, they only come into play when there's a version conflict; a simple upgrade instead causes an assignment to `.satisfied_by`, which is _later_ assigned to `.conflicts_with` and then triggers the uninstallation.)