Troubleshooting "Unable to locate package" when running `apt install`


Some users may run into an Unable to locate package response when using the apt package manager on Ubuntu and Debian-based images on CircleCI to fetch a package.

Running sudo apt install somepackage=12.3.4 -y results in the following message:

  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  E: Unable to locate package



  • Update Before Install
    • This can be a result of an out-of-date apt update cache.
    • The most common solution for this is to update apt using sudo apt update prior to running the sudo apt install command.
  • Confirm the package name matches the package hosted on the apt package manager
    • There are times when a package name does not match the name of the app/dependency it belongs to - some examples:
      • Docker's Package is called rather than just Docker
      • VSCode's package is called code rather than VSCode
  • Ensure that there are no typos within the package name or version
    • If the package name is misspelled or using a version that does not exist on the apt package manager, the apt install command will not be able to locate the package
  • Ensure that the package is available and compatible with the version being used in your pipelines
    • Not all packages might be available or compatible for all versions of Ubuntu



This issue can be considered resolved once the apt packages required by your team's projects all install successfully using the apt install command. If you are still encountering difficulties, please try all the solutions offered on this page.


Additional Resources

Was this article helpful?
123 out of 383 found this helpful



Article is closed for comments.