Score:1

Why is pip not upgrading cleanly on ubuntu 20.04 lts?

gb flag

pip upgrade is not working, shows it upgraded by version is still showing old version

root@ubuntu:~# pip install --upgrade pip
Collecting pip
  Downloading pip-22.0.3-py3-none-any.whl (2.1 MB)
     |████████████████████████████████| 2.1 MB 11.9 MB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-22.0.3

root@ubuntu:~# pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

root@ubuntu:~# pip install --upgrade pip
Collecting pip
  Using cached pip-22.0.3-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-22.0.3

root@ubuntu:~# pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

here are locations of python/pip

root@ubuntu:~# which pip
/usr/local/bin/pip
root@ubuntu:~# which pip3
/usr/local/bin/pip3
root@ubuntu:~# which python
/usr/bin/python
root@ubuntu:~# which python3
/usr/bin/python3
root@ubuntu:~# python3 -V
Python 3.8.10
root@ubuntu:~# python -V
Python 3.8.10
root@ubuntu:~# pip3 -V
pip 22.0.3 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
root@ubuntu:~# pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

i will like to cleanly point pip to pip3, like i did with apt install python-is-python3

is there a package like apt install pip-is-pip3?

I am trying to shy away from creating symlinks manually myself

Score:0
gb flag

Pretty much did this for now, but if anyone finds a non-manual way similar to apt install python-is-python3 please post

root@ubuntu:~# rm -rf /usr/local/bin/pip
root@ubuntu:~# ln -s /usr/local/bin/pip3 /usr/local/bin/pip

root@ubuntu:~# rm -rf /usr/lib/python3/dist-packages/pip
root@ubuntu:~# ln -s /usr/local/lib/python3.8/dist-packages/pip /usr/lib/python3/dist-packages/pip

root@ubuntu:~# pip -V
pip 22.0.3 from /usr/lib/python3/dist-packages/pip (python 3.8)
N0rbert avatar
zw flag
Be more careful next time. Trashing the system by many `pip`s in many locations will (and already did) your system unmanageable. I would suggest to remove all of `pip`s from `/usr/local/bin` and stick with `pip` and `pip3` from official Ubuntu repositories. Symlinks like `/usr/local/lib/python3.8/dist-packages/pip` → `/usr/lib/python3/dist-packages/pip` may cause unpredictable issues in future, I would suggest to avoid them.
uberrebu avatar
gb flag
well that is why i asked the question, how do we do something like `pip-is-pip3`? no one wants to be typing pip3
uberrebu avatar
gb flag
also pip was already in many places by default like i added in question, am not sure why python is always a pain to install...it should be easy to decide python2 or python3 and then install the python of choice as the default...should be that easy..not sure why it has to be rocket science to install python
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.