Pip3 version after multiple installations of python3

Hi,

let us say we have two python versions one is 3.6.8 and the other is 3.6.15 and initially I started out with 3.6.8 and it had pip 18.1 then I updated pip to 21.3.1 and then installed python 3.6.15.
3.6.15 comes with pip 18.1 so the system should have pip 18.1 right? I still see pip being in 21.3.1, is this expected? also in a python3 installation can there be multiple versions of pip3?
Thank you in advance.

Windows OS?

I think it should be what you see the newer version is not downgraded.

Not in the case of your pytohn 3.6 installation. The 3.6.15 will replace the 3.6.8.

If, however, you installed 3.12 as well then you would have 2 versions of python on your system. Each would have its own version of pip. On windows I would access each like this:

py -3.6 -m pip
py -3.12 -m pip

On unix/macOS I would access like this:

python3.6 -m pip
python3.12 -m pip

I’m running Ubuntu 16.04, and from our discussion, it seems like installing a newer version of Python3.6 won’t automatically downgrade the pip version present in previous Python3.6, correct? Just to be clear. Also if I have only Python3.6 installation on my machine I should not see two different pips, one installed through 3.6.8 and one through 3.6.15, only one of them should exists, and I am assuming the higher version of pip from the installations will prevail. Please correct me if I am wrong.

In this case, debian/ubuntu, there are seperate packages for python and pip.
When you update python the pip package is not changed.

I have packages python3 and python3-pip you can see all the packages that are installed using sudo apt list.

can I modify this for Ubuntu? I would want to have the pip with the latest installation, which files would I be required to change in the Python source?

I suspect you can just do python3.6 -m pip install --upgrade --user pip since you are on an old version of ubuntu.

For a newer version you would need to build a venv and update pip in that venv.

“The system” doesn’t have a Pip version. Each Python installation can have its own. The idea is that each Pip installs packages, for the associated Python.

“pip3” isn’t really a separate program; it’s an alias for Pip that gets included with Python 3.x installations.

The idea was that, back in the day when it was common to have both 2.x and 3.x Python versions installed, the pip3 command would automatically find “the” 3.x Python installation, because “the” 2.x installation wouldn’t have one; while pip could find “the” 2.x Python installation by simply having that folder appear earlier on the PATH.

Of course, as you’ve seen, it doesn’t really work that well. It’s easy to have multiple installations for a given Python version (even an identical patch version; that’s even normal now, because of virtual environments). On the other hand, different operating systems are used to arranging program folders differently - Windows makes a separate folder inside Program Files for each Python installation; Linux often puts all the main python executables side by side in /usr/bin while their supporting libraries might have separate folders inside /usr/lib, and a Python that comes with Linux might not have Pip at all.

Normally, when you install a new patch version of Python for the same minor version (like 3.6.15 over top of 3.6.8), it will replace the old one. But you absolutely can have it side-by-side instead (e.g. if one of them was installed only for the current user, and another was installed “for all users” / with admin privileges, or for a different user).

Did the 3.6.8 Python come with the system? (If so, did you use the system package manager to add Pip to it, or just what?)

Exactly what steps did you take to install 3.6.15?

If 3.6.8 and 3.6.15 are both present on the machine, then you have two separate Python3.6 installations, and each may have its own Pip.

Once you have Pip set up, it’s designed to be able to upgrade itself. You aren’t meant to do this manually.

Thank you Barry and Karl.

@kknechtel
I installed Python-3.6.8 using building through source and doing make install. I used the same steps for installing 3.6.15 i.e building through the source.