Package <package> has no installation candidate means that the package is not found in your Ubuntu releases software sources.
One possible reason for this message is that this package is an old package that has been discontinued from your release's default repositories. For example, qt4-default has been discontinued from the default repositories in Ubuntu 20.04 and later. To check for this possibility run the following command:
This command will show which Ubuntu releases provide this package and also will show which repository provides this package.
Another possible reason for this message is that this package is not available for your computer's CPU architecture. This is worth checking if your computer has an ARM processor. Once again run
rmadison <package> to show this information.
rmadison <package> will also show if the package you are looking for is only available as source code in which case you must download the package's source code with
apt-get source <package>, build a .deb file from the source you downloaded with a program such as checkinstall, and install the .deb file with
sudo apt install ./package.deb
Another possible reason for this message is that this package is not found in the list of available software because the list of available software software in the software sources has not been updated. To update the list of available software run the following command:
sudo apt update
aptitude is a terminal-based package manager with a command-line mode similar to that of apt-get only it is smarter. aptitude can help to resolve package conflicts that generate a
E: Package 'package-name' has no installation candidate error message.
sudo apt install aptitude
sudo aptitude install package-name # replace package-name with the name of a package
Let's say you get the following error message in Ubuntu 20.04.
E: Package 'libssl0.9.8' has no installation candidate
It seems that libssl is probably available in the Ubuntu 20.04 default repositories, but it has been renamed because libssl has been upgraded to a newer version. To check if libssl0.9.8 has been renamed in Ubuntu 20.04 run the following command:
apt-cache search "^libssl.*"
The results of
apt-cache search "^libssl.*" in 18.04-22.04 show that libssl0.9.8 has been upgraded to libssl1.1.