Skip to content
Latchkey

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.

pip output
Usage: pip install [options] <requirement specifier> ...
error: no such option: --hash-algorithm

Common 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

  1. Run pip install --help (or the relevant subcommand) to confirm the exact flag name.
  2. Make sure the option belongs to the subcommand you are running.
  3. Fix the spelling - many errors are --no-cache vs --no-cache-dir.

Upgrade pip if the flag is newer

Terminal
python -m pip install --upgrade pip
python -m pip --version

How 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →