pip uninstall: Remove Packages Cleanly
Remove a package and its top-level files.
pip uninstall removes a previously installed package. In CI you almost always pass -y so it does not block waiting for confirmation.
What it does
Removes the named package’s files and metadata. It does not remove dependencies that were pulled in alongside it.
Common usage
Terminal
pip uninstall -y requests
pip uninstall -y -r requirements.txt
pip uninstall -y package-a package-bCommon CI error: hangs on prompt
Without -y, pip uninstall prompts "Proceed (Y/n)?" and a non-interactive CI step hangs until it times out. Always pass -y in pipelines.
Terminal
# Hangs:
# Proceed (Y/n)?
# Fix:
pip uninstall -y requestsOptions
| Option | Does |
|---|---|
| -y, --yes | Do not ask for confirmation |
| -r, --requirement FILE | Uninstall everything in a file |
Related guides
pip install: Usage, Options & Common CI ErrorsHow pip install works - installing packages, version specifiers, and the options you reach for, plus the CI f…
pip list: Inspect Installed PackagesHow pip list shows installed packages and versions, the --outdated and --format flags useful in CI, and how t…