menu

Questions & Answers

Install Python3.8 on Ubuntu 22 server and got an error

I have a Ubuntu 22.04 server and I need to install Python3.8 on it.

Here is what I did:

sudo apt update
sudo apt upgrade
sudo apt install python3.8 -y

The last command gave me this error:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3.8 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3.8' has no installation candidate

The server I am working on is a GCP instance, and it has Python3.10 installed before:

root@ansible-3:/usr/bin# ll python*
lrwxrwxrwx 1 root root       7 Jan  5 23:39 python -> python3*
lrwxrwxrwx 1 root root      10 Aug 18 10:39 python3 -> python3.10*
lrwxrwxrwx 1 root root      17 Aug 18 10:39 python3-config -> python3.10-config*
-rwxr-xr-x 1 root root 5921160 Nov 14 16:10 python3.10*
lrwxrwxrwx 1 root root      34 Nov 14 16:10 python3.10-config -> x86_64-linux-gnu-python3.10-config*

Any idea what is going on?

Thanks!

Comments:
2023-01-07 20:30:20
This means of all the repositories listed in your software sources, none of them have the package named python3.8 source. Try to follow this article
2023-01-07 20:30:20
I would highly recommend you use virtual environments. With the use of virtualenv you can create a virtual environment and install a specific python version. The virtual environment is siloed and won't affect any global installation.
2023-01-07 20:30:20
Thank you both for your replies and I will give it a try.
Answers(0) :