This error occurs when apt cannot find a package in your configured repositories. It typically means the package is unavailable for your Ubuntu/Debian version, or your package lists are outdated.
The "Package 'package-name' has no installation candidate" error indicates that apt has found a reference to the package in its database, but cannot locate any available version that can be installed on your system. This happens because apt cannot find the package in any of the enabled repositories, which could be due to several reasons: your package cache is out of date, the required repository is not enabled, the package has been renamed or removed, or the package is not available for your specific system architecture or OS version.
The most common cause is an outdated package list. Update apt's cache to sync with remote repositories:
sudo apt updateThis downloads the latest package lists from all enabled repositories. After running this, try installing the package again:
sudo apt install package-nameIf this fixes the issue, the problem was simply an outdated cache.
Package names in Linux are case-sensitive. Verify you're using the correct name:
apt search package-nameThis searches for packages matching your query. Look for the exact name you need. For example, if you're looking for Python 3, the package is python3, not Python3 or python.
You can also check the Ubuntu Package Search online at https://packages.ubuntu.com/
View which repositories are currently enabled:
cat /etc/apt/sources.listLook for commented-out lines (starting with #). Some repositories like universe and multiverse are not enabled by default on all Ubuntu installations.
To enable the universe repository:
sudo add-apt-repository universe
sudo apt updateTo enable multiverse:
sudo add-apt-repository multiverse
sudo apt updateIf a package is only available in a newer version of Ubuntu, you can try using a Personal Package Archive (PPA) that provides a backport:
sudo add-apt-repository ppa:repository-name
sudo apt update
sudo apt install package-nameFor example, to get newer versions of common tools, search for the package on launchpad.net to find the appropriate PPA.
If the package still isn't available, consider alternatives:
For Ubuntu/Debian, try snap packages:
sudo snap install package-nameFor development tools, check if the project provides direct downloads or uses other package managers like pip, npm, or cargo:
# Python packages
pip install package-name
# Node.js packages
npm install -g package-nameFor older Ubuntu versions, use the ubuntu-backports repository to access newer packages:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-backports main restricted universe multiverse"
sudo apt updateIf you're using non-standard Ubuntu flavors (Linux Mint, Elementary OS, etc.), the repository URLs may differ. Check your distribution's documentation for the correct repositories.
On Debian, ensure you have the correct entries for your release (stable, testing, sid). Using packages from testing or sid on a stable system can cause conflicts and broken dependencies.
E: Could not connect to proxy server
Could not connect to proxy server
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt
E: The value 'value' is invalid for APT::Default-Release
How to fix invalid APT::Default-Release value in APT
dpkg: error: unable to create new file 'path': Permission denied
How to fix dpkg permission denied errors in APT
subprocess installed post-removal script returned error exit status 1
How to fix "subprocess installed post-removal script returned error exit status 1" in APT