pip "error: no such option" - Fix Bad Flags & Wrapped Lines in CI
pip rejected a command-line flag or a requirements-file option it does not recognize. Either the option is misspelled, belongs to a different subcommand, or your pip is too old to know it.
What this error means
pip aborts immediately with error: no such option: --xyz. Nothing installs because pip never parses past the bad option. It can come from the command line or from an option line inside requirements.txt.
Usage: pip install [options] <requirement specifier> ...
error: no such option: --hash-algorithmCommon causes
Misspelled or wrong-subcommand flag
A typo (--no-cache vs --no-cache-dir) or a flag valid for another subcommand (pip download vs pip install) makes pip reject it.
Option unsupported by this pip version
An option added in a newer pip fails on an older one. The CI image’s pip may predate the flag you copied from current docs.
A stray option line in requirements.txt
requirements files accept a limited set of options (--hash, --index-url, -e). An unsupported option on its own line triggers the same error.
How to fix it
Check the option and the subcommand
- Run
pip install --help(or the relevant subcommand) to confirm the exact flag name. - Make sure the option belongs to the subcommand you are running.
- Fix the spelling - many errors are
--no-cachevs--no-cache-dir.
Upgrade pip if the flag is newer
python -m pip install --upgrade pip
python -m pip --versionHow to prevent it
- Pin a known pip version in CI and check flags against its
--help. - Keep requirements-file options to the documented subset.
- Upgrade pip early so newer flags are available.