How to install Python 3.8 on Ubuntu?

mortoray profile image edA‑qa mort‑ora‑y ・1 min read

I'm having no luck getting Python 3.8 running on (K)Ubuntu 18.04. I've got the main program installed, but it's lacking pip.

I did:

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

Then as tests, I also did:

sudo apt install python3.8-distutils

python3.8 -m pip install --upgrade pip setuptools wheel

But if I try to setup a virtual env, it fails:

$ python3.8 -m venv env
Error: Command '['/src/mdl/env/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

The module ensurepip isn't there, nor can it be installed.

$ python3.8 -m ensurepip
/usr/bin/python3.8: No module named ensurepip

How do I install Python 3.8, along with a separate pip and package directory?

I got further with the below, added -venv and -dev to compile more packages.

sudo apt install python3.8-venv python3.8-dev

This appeared not to work at first, but it was a 3.8 compatibility problem with a particular package, unfortunately mypy. The reason I want 3.8 is for annotations support, so this is unfortunate. They indicated a new release is coming to fix it.

Posted on by:

mortoray profile

edA‑qa mort‑ora‑y


I'm a creative writer and adventurous programmer. I cook monsters.


markdown guide

Digging through some closed issues I found you need to install python3.8-venv:

sudo apt-get install python3.8-venv

Now this works:

python3.8 -m venv env

I'm sorry if this doesn't help. I thought of giving my two cents.

Try installing Anaconda. It's a superset of Python and comes with most commonly used packages by default. It uses a package manager called conda, which you can use for installing additional packages.
Installing Anaconda on Ubuntu 18.04

You might also find IPython really useful. It brings Jupyter notebook like features to the terminal.

Installing IPython


I think you may be missing this step: sudo apt-get install python3-pip (from vsupalov.com/developing-with-pytho...).


I have that installed, and that pip doesn't work correctly with python3.8. I needed the python3.8-venv to create a virtual environment, and then I could use pip within it.


I encountered the same problem. Finally I use pyenv to install Python 3.8 on Ubuntu 18.04.