/errors/apt/unable-to-locate-package
apt: E: Unable to locate package
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- apt
- exit code
- 100
- versions
- Debian 10+, Ubuntu 18.04+
- os
- linux
apt install foo prints E: Unable to locate package foo when foo is not in the package lists apt has downloaded. apt does not search the internet at install time; it only knows what the last apt update fetched from the repositories in /etc/apt/sources.list and /etc/apt/sources.list.d/.
Fix: update the package lists
sudo apt update
sudo apt install fooIn a Dockerfile the base image ships without lists, so always combine both steps:
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*Fix: find the right name
apt search --names-only 'python3-.*requests'
apt-cache policy python3-requests # shows candidate version and repository, or nothingNames often differ between distributions and releases: Python libraries are python3-*, development headers are lib*-dev.
Fix: enable the component or repository
sudo add-apt-repository universe # Ubuntu
sudo apt updateOn Debian, add contrib non-free non-free-firmware to the Components: line of the source (see deb822 sources).
Sources
Related pages
errors · aptapt: Could not get lock /var/lib/dpkg/lock-frontendapt fails with Could not get lock /var/lib/dpkg/lock-frontend while another apt, dpkg or unattended-upgrades runs. Wait for it; never delete the lock.config · aptapt sources in deb822 format: .sources files and Signed-ByDebian 12+ and Ubuntu 24.04 describe apt repositories in .sources files (deb822 format). The Types, URIs, Suites, Components and Signed-By fields explained.glossary · aptWhat is a PPA on Ubuntu?A PPA (Personal Package Archive) is an apt repo on Launchpad where a person or team publishes Ubuntu packages, added with add-apt-repository ppa:owner/name.