1

I had a problem uploading a sketch from the Arduino IDE to an ESP32, the warning was that python was missing from the $PATH. I did a which pythonwhich didn't return anything. This was strange because before upgrading from 19.10 to 20.04 I had no problems uploading from the Arduino IDE to an ESP32 .

I've noticed that the 20.04 upgrade removes quite a few often used Gnome apps such as gnome-logs and gnome-calculator, in fact I mentioned it here. So I simply ran sudo apt install python to reinstall python. Python was installed and the IDE is now uploading to the ESP32 as it should. But I noticed that the version of Python installed was python2, which I thought was end of life and had been replaced with python3. Why is the Ubuntu repository still installing python2? And should I remove this and install python3?

Edit: Output of dpkg -l | grep python-is

ii python-is-python2 2.7.17-4
all symlinks /usr/bin/python to the DEPRECATED python2

1
  • You may have installed some package before which installed python-is-python2 before as dependency, I think. Please add output of dpkg -l | grep python-is to the question by editing it.
    – N0rbert
    Jul 26, 2020 at 16:27

1 Answer 1

0

In Ubuntu, the following terms apply to ALL supported releases:

  • The python command refers to the Python 2 interpreter only. deb packages with 'python-' in the package name are compatible with Python 2 only.
  • The python3 command refers to the Python 3 interpreter only. deb packages with 'python3-' in the package name are compatible with Python 2 only.

Reasons:

  1. Py3 introduced some changes that are not backward-compatible with Py2. Therefore, folks must specify the correct interpreter...the interpreter cannot reliably figure it out on it's own.

  2. Pep 394 allows Ubuntu to change python to point to py3, but does not require it. Instead, it requires consistent, predicatable usage.

  3. Regardless of what upstream projects do, Ubuntu provides support for LTS releases up to 10 years (5 years community support, 5 more years Extended Security Maintenance). Python 2 will continue to be in various releases of Ubuntu until 2028, when Ubuntu 18.04 is retired.

    Until then, changing the name will be hopelessly confusing and frustrating. Which online answers are correct? Which documentation should you use? How will new users with problem express to AskUbuntu which version of Python they are using when they don;t know that there is a difference?

  4. The Ubuntu Developers have expressed no interest in changing the name. Some other upstream projects (like QT) similarly include a version number in their application name to avoid confusion between incompatible versions. Perhpas that will change in a few years...but perhaps not.

Not the answer you're looking for? Browse other questions tagged .