Removing python 2.7 from Ubuntu 20.04

As you know Python 2.7 is deprecated and shouldn’t be used after Jan 1 2020: https://www.python.org/doc/sunset-python-2/

Yet Ubuntu 20.20 comes with “python” defined to python 2.7!

I faced many issues recently because “pip” wasn’t present and today while installing Espressif IDF 4.2 I got many errors because python 2.7 still used on Ubuntu:

$ idf.py set-target esp32
The following Python requirements are not satisfied:
gdbgui>=0.13.2.0
To install the missing packages, please run "/home/alan/esp/esp-idf/install.sh"
Diagnostic information:
IDF_PYTHON_ENV_PATH: /home/alan/.espressif/python_env/idf4.2_py3.6_env
Python interpreter used: /home/alan/.espressif/python_env/idf4.2_py3.6_env/bin/python

I solved my issues removing python 2 and installing python3 as default:

$ sudo apt purge python2.7-minimal
$ sudo apt install python-is-python3

After doing it I got IDF installed correctly.

2 thoughts on “Removing python 2.7 from Ubuntu 20.04

  1. I am running Mint 19.3 which is derived from Ubuntu (Linux version 5.3.0-59-generic (buildd@lcy01-amd64-025) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020).
    PIP was not installed but “sudo apt install python-pip” installed it with no problem – so, I’ll just leave python alone and wait for the Mint folks to migrate over to the new Python.

    1. Hi Celem,
      I think it is fine to wait. In my cause it was causing issues on IDF. The IDF thinks I’m using python 2.7 because the python binary was in fact version 2.7, but all other SW in the distro was using python 3.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s