How to install Python 3.8 on Ubuntu?

mortoray

edA‑qa mort‑ora‑y

Posted on June 16, 2019

How to install Python 3.8 on Ubuntu?

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
Enter fullscreen mode Exit fullscreen mode

Then as tests, I also did:

sudo apt install python3.8-distutils

python3.8 -m pip install --upgrade pip setuptools wheel
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

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

$ python3.8 -m ensurepip
/usr/bin/python3.8: No module named ensurepip
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.

💖 💪 🙅 🚩
mortoray
edA‑qa mort‑ora‑y

Posted on June 16, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related