-
List all installed packages with version and usage.
-
Classify packages as:
System (do not remove)
Required by another package
Application (safe to uninstall if unused)
-
Detect and display orphaned packages (installed but not required by others).
-
Provide an interactive uninstall tool for orphaned packages.
-
Automatically installs pipdeptree if missing.
- Package, Version, Used By
-
Interactive uninstall options:
-
Remove all orphaned packages
-
Remove specific orphaned packages
Helps keep your Python environment clean and lightweight.
Clone the repository and install dependencies:
git clone https://github.com//python-package-cleaner.git cd python-package-cleaner python3 python_package_cleaner.py
If you don’t have pipdeptree, don’t worry — the script will install it automatically.
Run the script:
python python_package_cleaner.py
Example output: Scanning installed packages... Table of all the installed packages Then the script will ask:
Orphaned packages safe to uninstall:
- openai (1.102.0)
- pandas (2.3.2)
Do you want to uninstall any of these packages? (y/n):
System packages (pip, setuptools, wheel, etc.) are marked as do not remove.
Removing required packages may break dependencies.
MIT License.