How to fix E: Version 'x.x.x' for 'package-name' was not found in APT
The "Version was not found" error occurs when you try to install a specific version of a package that is not available in any of your configured repositories. This happens because the exact version string does not match available versions, the version is too old or new, or the package is no longer maintained in your repositories.
Quick fix
Fixes E: Version 'x.x.x' for 'package-name' was not found
apt-cache policy package-name- List all available versions for the package
- Copy the exact version string from apt-cache
- Update your package cache
- Check if the version exists for your distribution
apt-cache policy package-nameE: Version 'x.x.x' for 'package-name' was not found
What this error means
This error appears when you use apt-get install with a specific version number (using the syntax `package=version`) but that exact version cannot be found in any of your configured repositories. The apt package manager searches through all enabled repositories for the specified version, and if it cannot locate it, the installation fails. This differs from the "Unable to locate package" error—the package exists, but the specific version you requested does not. Version format mismatches are common: the version string must match exactly what apt lists in its cache, including release names, epoch numbers, and build designations.
Typical symptoms
- Error displays "E: Version 'x.x.x' for 'package-name' was not found" when using apt install
- Cannot install a specific package version with syntax like sudo apt install package=1.2.3
- Version appears in apt-cache policy output but installation fails with version not found error
- Cannot downgrade or upgrade to a particular version of an application
Common causes
- Version format does not exactly match the repository version string (most common)
- The specified version is too old and has been removed from active repositories
- The specified version is not available for your Ubuntu/Debian distribution version
- The package repository does not maintain the requested version
- Package cache is outdated and does not include newly available versions
- Version is only available in a disabled or removed PPA or third-party repository
How to fix "E: Version 'x.x.x' for 'package-name' was not found"
First, check what versions are actually available in your repositories using apt-cache:
apt-cache policy package-nameThis command shows all available versions with their sources. For example, if you run this for Docker:
apt-cache policy docker-ceYou will see output like:
docker-ce:
Installed: (none)
Candidate: 5:24.0.6~3-0~ubuntu-focal
Version table:
5:24.0.6~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:24.0.5~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 PackagesNotice the exact format including colons, tildes, and build numbers.
The version you install must match exactly what appears in the apt-cache output. Do not simplify or abbreviate the version number. For example:
Incorrect (will fail):
sudo apt install docker-ce=18.03.0.ceCorrect:
sudo apt install docker-ce=5:18.03.0~ce-0~ubuntuNote the differences:
- Colons (epoch): 5:
- Tildes instead of dots: ~ce instead of .ce
- Build designation: -0~ubuntu
Always copy the complete version string from apt-cache policy output.
If you cannot find the version you need, your package cache may be outdated. Update it:
sudo apt updateThis command refreshes your local cache of available packages from all enabled repositories. Sometimes newly released versions or older versions are added back to repositories, and you need to update to see them.
Some versions may only be available for specific Ubuntu/Debian versions. Check your current distribution:
lsb_release -aOr more concisely:
lsb_release -csWhen searching for packages online (e.g., at packages.ubuntu.com), make sure you select the correct distribution version. A version available for Ubuntu 20.04 (Focal) may not be available for Ubuntu 22.04 (Jammy).
If the version you need is from a PPA or third-party repository that you removed or disabled:
sudo add-apt-repository ppa:owner/ppa-name
sudo apt update
apt-cache policy package-nameThen install using the exact version from the new apt-cache output:
sudo apt install package-name=x.x.xYou can also check what PPAs are enabled:
add-apt-repository --list | grep ppaOnce you have confirmed the exact version string from apt-cache policy, install it:
sudo apt install package-name=exact.version.stringFor example:
sudo apt install nginx=1.18.0-6ubuntu14.4The installation should succeed if the version string is exact. If it still fails, double-check the version string character-by-character against the apt-cache output.
Advanced notes
The version string format in Debian/Ubuntu follows the format [epoch:]upstream-version[-debian-revision]. The epoch (colon-prefixed number) is used when the upstream version numbering scheme changes. Tildes (~) have special meaning in version comparison—they sort earlier than the character they precede, so 1.0~rc1 sorts before 1.0. Some packages use epoch numbers extensively (like Docker with 5: prefix) to ensure proper version ordering. If you need a very old version no longer in main repositories, check Ubuntu security archives: http://security.ubuntu.com/ or http://archive.ubuntu.com/. You can also pin specific versions using /etc/apt/preferences to prevent automatic upgrades: sudo nano /etc/apt/preferences and add entries specifying package pins.
Frequently asked questions
- What does "E: Version 'x.x.x' for 'package-name' was not found" mean?
- This error appears when you use apt-get install with a specific version number (using the syntax package=version) but that exact version cannot be found in any of your configured repositories. The apt package manager searches through all enabled repositories for the specified version, and if it cannot locate it, the installation fails. This differs from the "Unable to locate package" error—the package exists, but the specific version you requested does not.
- How do I fix "E: Version 'x.x.x' for 'package-name' was not found"?
- The "Version was not found" error occurs when you try to install a specific version of a package that is not available in any of your configured repositories. This happens because the exact version string does not match available versions, the version is too old or new, or the package is no longer maintained in your repositories.
- What causes "E: Version 'x.x.x' for 'package-name' was not found"?
- Version format does not exactly match the repository version string (most common) The specified version is too old and has been removed from active repositories The specified version is not available for your Ubuntu/Debian distribution version
- Is the "E: Version 'x.x.x' for 'package-name' was not found" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.