Skip to content
Latchkey

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-b

Common 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 requests

Options

OptionDoes
-y, --yesDo not ask for confirmation
-r, --requirement FILEUninstall everything in a file

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →