python install_error ai_generated true

ERROR: Cannot uninstall 'package_name'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

ID: python/pip-cannot-uninstall-required-by

Also available as: JSON · Markdown · 中文
80%Fix Rate
83%Confidence
0Evidence
2025-09-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —

Root Cause

The package was installed via distutils, and pip cannot safely uninstall it.

generic

中文

包是通过 distutils 安装的,pip 无法安全卸载。

Workarounds

  1. 80% success Reinstall the package with pip first
    pip install --force-reinstall package_name && pip uninstall package_name
  2. 90% success Use a virtual environment
    python -m venv newenv && source newenv/bin/activate && pip install package_name

Dead Ends

Common approaches that don't work:

  1. Using --force to uninstall 50% fail

    May leave broken files.

  2. Manually deleting files 70% fail

    Risky and incomplete.