python install_error ai_generated true

ERROR: Cannot uninstall 'numpy'. 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-requirement-already-satisfied-but-wrong-version

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-08-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

The package was installed by the OS package manager (apt/dnf) or an old distutils path, so pip has no RECORD file to drive a clean uninstall.

generic

中文

该包由操作系统包管理器(apt/dnf)或旧式 distutils 路径安装,因此 pip 没有 RECORD 文件来执行干净的卸载。

Workarounds

  1. 90% success
    Remove the OS-managed copy first: `sudo apt-get remove python3-numpy` (or `dnf remove python3-numpy`), then `pip install numpy` inside a venv.
  2. 93% success
    Work in a fresh venv that does not inherit system site-packages: `python -m venv --system-site-packages=false .venv`.

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Leaves two overlapping copies in site-packages; imports become order-dependent and hard to debug.

  2. 85% fail

    The distutils guard still triggers; sudo does not create a RECORD file.