I’m trying to install pip for Python 3.8 on an Ubuntu 18.04 LTS.

I know this has been asked way too many times. But those questions do not concern keeping Ubuntu’s defaults specifically. And the answers on those questions either don’t work or go on to suggest something so drastic that it would break the system – e.g. change default python3 version from 3.6 to 3.8. You SHOULDN’T!

So far, I’ve been able to install python3.8 successfully using the PPAppa:deadsnakes/ppa:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8

Changed python command from python2 to python3.8 using update-alternatives:

update-alternatives --remove python /usr/bin/python2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 10

Now, I get python 3.8 when I run python --version:

Python 3.8.5

The problem is, I still can’t install pip for Python 3.8.
If I try to install python3-pip, it installs pip for Python 3.6 since python3 still points to python3.6.9, and I intend to keep it that way.
Try installing python-pip, and it will install pip for Python 2.7.
Also there’s no such package as python3.8-pip, so I can’t install it like:

sudo apt install python3.8-pip


E: Unable to locate package python3.8-pip
E: Couldn’t find any package by glob ‘python3.8-pip’
E: Couldn’t find any package by regex ‘python3.8-pip’

What can I do to install pip for Python 3.8 on an Ubuntu 18.04?

While we can use pip directly as a Python module (the recommended way):

python -m pip --version

This is how I installed it (so it can be called directly):
Firstly, make sure that command pip is available and it isn’t being used by pip for Python 2.7

sudo apt remove python-pip

Now if you write pip in the Terminal, you’ll get that nothing is installed there:

pip --version


Command ‘pip’ not found, but can be installed with:

sudo apt install python-pip

Install python3.8 and setup up correct version on python command using update-alternatives (as done in the question).

Make sure, you have python3-pip installed:
(This won’t work without python3-pip. Although this will install pip 9.0.1 from python 3.6, we’ll need it.)

sudo apt install python3-pip

This will install pip 9.0.1 as pip3:

pip3 --version


pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Now, to install pip for Python 3.8, I used pip by calling it as a python module (ironic!):

python -m pip install pip


Collecting pip
  Downloading https://files.pythonhosted.org/packages/36/74/38c2410d688ac7b48afa07d413674afc1f903c1c1f854de51dc8eb2367a5/pip-20.2-py2.py3-none-any.whl (1.5MB)
  100% |????????????????????????????????| 1.5MB 288kB/s
Installing collected packages: pip
Successfully installed pip-20.2

It looks like, when I called pip (which was installed for Python 3.6, BTW) as a module of Python 3.8, and installed pip, it actually worked.

Now, make sure your ~/.local/bin directory is set in PATH environment variable:
Open ~/.bashrc using your favourite editor (if you’re using zsh, replace .bashrc with .zshrc)

nano ~/.bashrc

And paste the following at the end of the file

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then

Finally, source your .bashrc (or restart the Terminal window):

source ~/.bashrc

Now if you try running pip directly it’ll give you the correct version:

pip --version


pip 20.2 from /home/qumber/.local/lib/python3.8/site-packages/pip (python 3.8)


As suggested in official documentation you can try with get-pip.py.

wget https://bootstrap.pypa.io/get-pip.py
python3.8 get-pip.py

This will install pip as pip3.8

# install py3.8 and dependencies for the pip3 bootstrap script
add-apt-repository -y ppa:deadsnakes/ppa && \
    apt install -y python3.8 python3.8-distutils

# download and run the pip3 bootstrap script
cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && \
    python3.8 /tmp/get-pip.py

# use pip py3.8 module to install python packages
python3.8 -m pip install numpy pandas

Another solution would be to install the pip that is in apt. sudo apt install python3-pip. The version of the pip that it installs is for all versions of Python not only for version 3.6 once installed you just need to update the pip with the command python3.8 -m pip install pip and he will be install the latest version of pip for Python.

I would not advise you to remove Python2 because it is an important module for the system you should just create a permanent “alias” in .bashrc for Python3 I did like this alias python="python3.8.

I did this a couple days ago and I struggled a lot with it but I finally got it working, so I wrote up what I did as a blog post.

In the end I think I may have done mostly the same things as the above answer, but if you got lost following it, maybe my screenshots etc will help.

Here’s the tl;dr of the process I did:

  • Uninstall python3-pip & python-pip using apt
  • Remove the old pip files from /usr/local/bin
  • Reinstall python3-pip using apt
  • Add $HOME/.local/bin to your $PATH (also restart your shell to make sure you did this right)