How to fix E: Unable to locate package --install in APT
apt treats "--install" as a package name instead of a command flag when placed after "apt". This is a syntax error caused by incorrect command ordering or quoting issues.
Quick fix
Fixes E: Unable to locate package --install
apt install <package-name>- Verify the correct apt install syntax
- Check your command history for incorrect patterns
- Re-run with correct syntax
- Verify the package exists (if still getting errors)
apt install <package-name>E: Unable to locate package --install
What this error means
The "Unable to locate package --install" error occurs when you try to install a package using apt but place the "--install" flag in the wrong position or when apt interprets it as a literal package name to search for in the repository. In apt, the correct syntax is "apt install <package-name>". However, some users accidentally write commands like "apt --install package" or accidentally quote or structure the command incorrectly, causing apt to search for a package literally named "--install" which doesn't exist in any repository. This is purely a command syntax issue, not a problem with package repositories or system configuration.
Typical symptoms
- Running apt command results in 'E: Unable to locate package --install' error
- The --install flag appears as a package name in the error message
- Command structure looks unusual or has flags in wrong order
- Works fine when command syntax is corrected
Common causes
- Using incorrect syntax like 'apt --install package' instead of 'apt install package'
- Misplaced command flags or arguments in wrong order
- Copying command examples incorrectly or truncating them mid-way
- Accidentally wrapping the command in quotes or shell constructs that treat flags as literals
How to fix "E: Unable to locate package --install"
The correct syntax for apt install is:
apt install <package-name>If you're running as a non-root user, use sudo:
sudo apt install <package-name>The package name comes AFTER the "install" keyword. Make sure you're not accidentally putting "--install" where the package name should be.
Review what you actually typed by checking your shell history:
history | grep aptLook for patterns like:
- apt --install package-name (wrong order)
- apt -install package-name (missing second dash)
- apt install --install package-name (duplicated flags)
- apt install --install (no package name)
Correct any of these patterns by reordering to: apt install package-name
Once you've identified the correct package name you want to install, run:
sudo apt update
sudo apt install correct-package-nameFor example, to install curl:
sudo apt install curlNOT:
sudo apt --install curl # Wrong!
sudo apt install --install # Wrong!If the error persists after fixing syntax, search for the correct package name:
apt search package-keywordThis will show available packages matching your keyword. For instance:
apt search curlThen install using the exact package name shown in the search results:
sudo apt install curlThis is helpful when you're not sure of the exact package name or if it's available in your system's repositories.
Advanced notes
This error is a syntax/user error, not a system or repository configuration issue. It's different from the general "Unable to locate package" error which can result from outdated package caches, missing repositories, or genuinely unavailable packages. The "--install" variant specifically indicates the flag was passed as if it were a package name, which only happens with incorrect command syntax. No advanced troubleshooting (like adding PPAs or updating sources) will fix this - only correcting the command structure will resolve it.
Frequently asked questions
- What does "E: Unable to locate package --install" mean?
- The "Unable to locate package --install" error occurs when you try to install a package using apt but place the "--install" flag in the wrong position or when apt interprets it as a literal package name to search for in the repository. In apt, the correct syntax is "apt install <package-name>". However, some users accidentally write commands like "apt --install package" or accidentally quote or structure the command incorrectly, causing apt to search for a package literally named "--install" which doesn't exist in any repository.
- How do I fix "E: Unable to locate package --install"?
- apt treats "--install" as a package name instead of a command flag when placed after "apt". This is a syntax error caused by incorrect command ordering or quoting issues.
- What causes "E: Unable to locate package --install"?
- Using incorrect syntax like 'apt --install package' instead of 'apt install package' Misplaced command flags or arguments in wrong order Copying command examples incorrectly or truncating them mid-way
- Is the "E: Unable to locate package --install" error serious?
- It is a low-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐Debian Manual: apt - command line interface for APT(Official Docs)
- ๐