What pip Is Rejecting
pip does not have update or upgrade subcommands. Upgrading packages is done with pip install --upgrade ....
Fix the command
To upgrade a package with python -m pip install --upgrade <package>, to upgrade pip itself with python -m pip install --upgrade pip, and to review what would be upgraded with python -m pip list --outdated.
Check the exact command and local inputs
See available commands with python -m pip help, and check which pip you're using with python -m pip --version.
Typical Output
ERROR: unknown command "update"
ERROR: unknown command "upgrade" Why the Command Was Rejected
Usually this comes down to you ran pip update ... or pip upgrade ..., but those are not valid pip subcommands, or you expected pip to behave like an OS package manager.
Re-run the Minimal Correct Command
Run python -m pip list --outdated and confirm the package is no longer listed (if it was upgraded), and re-run your install/upgrade command and confirm pip no longer reports an unknown subcommand.
How pip validates the command before it runs
This is the part worth understanding if the quick fix did not hold. It explains what pip is trying to do at the moment the error appears.
pip uses subcommands like install, uninstall, list, and show.
Package upgrades are performed by re-running install with the --upgrade flag.
Upgrading pip itself is also performed with install --upgrade pip in the active environment.
Avoid Command and Config Drift
To prevent this, prefer python -m pip ... so the right pip is used for the active interpreter, use pip help <command> to confirm syntax before scripting it, and use virtual environments so upgrades don't affect system Python.
Docs and source code
github.com/pypa/pip/blob/25.3/src/pip/_internal/cli/main_parser.py
pip raises a CommandError with unknown command "..." when the first CLI argument is not a valid subcommand. - GitHub
# the subcommand name
cmd_name = args_else[0]
if cmd_name not in commands_dict:
guess = get_similar_commands(cmd_name)
msg = [f'unknown command "{cmd_name}"']
if guess:
msg.append(f'maybe you meant "{guess}"')
raise CommandError(" - ".join(msg))