python install_error ai_generated partial

WARNING: Skipping mypkg as it is not installed. ERROR: Cannot uninstall 'mypkg'. 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-uninstall-no-files-were-found

Also available as: JSON · Markdown · 中文
80%Fix Rate
83%Confidence
0Evidence
2024-04-23First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

The package was installed by distutils (e.g., via setup.py install or an OS package) without a RECORD file, so pip cannot enumerate the files to remove.

generic

中文

该包由 distutils 安装(例如通过 setup.py install 或操作系统包),没有 RECORD 文件,因此 pip 无法枚举要删除的文件。

Workarounds

  1. 85% success
    python -c "import mypkg, os; print(os.path.dirname(mypkg.__file__))"
    rm -rf /path/to/mypkg /path/to/mypkg-*.egg-info
  2. 90% success
    sudo apt remove python3-mypkg

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The -y flag suppresses the prompt but the distutils detection still aborts.

  2. 60% fail

    Force reinstall may leave the distutils-installed files behind, so uninstall still cannot find them.

  3. 85% fail

    --break-system-packages is for installs, not for distutils uninstall detection.