6

I currently have python 3.8 installed. I also installed python 3.11 seperately, but the default python3 alias points to 3.8:

➜  ~ python3 --version
Python 3.8.10
➜  ~ python3.11 --version
Python 3.11.1

I want to upgrade the default alias to 3.11, system wide, because I am using uLauncher with the Todoist plugin, which uses the python package todoist-api-python

The problem: The latest version of the package requires at least python 3.9, but at least on my system, the default python3 points to 3.8, which won't work. So whenever I install the package, it would install an older version, which uses an old, deprecated version of the todoist API and this does not work anymore.

There is no way to tell uLauncher to use the already installed python3.11, As far as I know.

So I tried to switch the python3 alias to point to 3.11 by using update-alternatives like described here

At first, I was happy, when I saw python3 --version print out 3.11, but I quickly realized that this actually broke major things. The uLauncher application, the reason why I'm trying to do this python upgrade, did not launch anymore, and even the default gnome-terminal won't start up anymore.

So I went back to python3 pointing to 3.8 in order to be able to use my computer properly, but the original problem still exists.

I suspect applications depend on python and expect 3.8, so they break when python3 points to something else.

How can I upgrade to python 3.11 on Ubuntu 20.04 without breaking major applications?

Rishon_JR
  • 1,013
Paul H
  • 161
  • 1
  • 2

1 Answers1

3

How can I upgrade to python 3.11 on Ubuntu 20.04 without breaking major applications?

You can't ... See why?

What to do? ... Create a python3.11 virtual environment ... Then install todoist-api-python in it like so:

ubuntu@Lenovo:~/test$ mkdir venv3_11 && cd venv3_11
ubuntu@Lenovo:~/test/venv3_11$ python3.11 -m venv env
ubuntu@Lenovo:~/test/venv3_11$ source env/bin/activate
(env) ubuntu@Lenovo:~/test/venv3_11$ pip3 install todoist-api-python
Collecting todoist-api-python
  Using cached todoist_api_python-2.0.2-py3-none-any.whl (11 kB)
Collecting attrs<23.0.0,>=22.0.0
  Using cached attrs-22.2.0-py3-none-any.whl (60 kB)
Collecting requests<3.0.0,>=2.26.0
  Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.6/140.6 KB 369.4 kB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 KB 1.3 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 KB 2.9 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (196 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 196.8/196.8 KB 2.4 MB/s eta 0:00:00
Installing collected packages: charset-normalizer, urllib3, idna, certifi, attrs, requests, todoist-api-python
Successfully installed attrs-22.2.0 certifi-2022.12.7 charset-normalizer-3.0.1 idna-3.4 requests-2.28.2 todoist-api-python-2.0.2 urllib3-1.26.14
(env) ubuntu@Lenovo:~/test/venv3_11$ 

Then all you need to to do from now on to use that package is to activate that virtual environment ... Python in a virtual environment installs packages/modules and runs them exactly like the system-wide Python does but in a safe isolated environment.

Raffa
  • 32,237