What This Error Means
pip does not have update or upgrade subcommands. Upgrading packages is done with pip install --upgrade ....
How to Fix It
- To upgrade a package:
python -m pip install --upgrade <package>. - To upgrade pip itself:
python -m pip install --upgrade pip. - To review what would be upgraded:
python -m pip list --outdated.
Why It Happens
- You ran
pip update ...orpip upgrade ..., but those are not valid pip subcommands. - You expected pip to behave like an OS package manager.
How to Verify
- Run
python -m pip list --outdatedand confirm the package is no longer listed (if it was upgraded). - Re-run your install/upgrade command and confirm pip no longer reports an unknown subcommand.
Manual command discovery
- See available commands:
python -m pip help. - Check which pip you're using:
python -m pip --version.
Common CLI Output
ERROR: unknown command "update"ERROR: unknown command "upgrade" How pip commands work
- pip uses subcommands like
install,uninstall,list, andshow. - Package upgrades are performed by re-running
installwith the--upgradeflag. - Upgrading pip itself is also performed with
install --upgrade pipin the active environment.
Prevention Tips
- Prefer
python -m pip ...so the right pip is used for the active interpreter. - Use
pip help <command>to confirm syntax before scripting it. - Use virtual environments so upgrades don't affect system Python.
Where This Can Be Triggered
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))