ERROR pip install_error ai_generated true

ERROR: Cannot uninstall requirement '<package>', not installed. It is only installed as an editable package.

ID: pip/req-uninstall-editables-only

Also available as: JSON · Markdown · 中文
78%Fix Rate
85%Confidence
1Evidence
2023-01-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.3 active
pip 22.0.4 active
pip 23.2 active

Root Cause

Pip refuses to uninstall a package that was installed with `-e` (editable) mode when the user attempts to uninstall it with a non-editable specifier or a version mismatch.

generic

中文

当用户尝试使用非可编辑说明符或版本不匹配来卸载一个通过 `-e`(可编辑)模式安装的包时,pip 拒绝卸载。

Official Documentation

https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs

Workarounds

  1. 85% success Reinstall the package in non-editable mode first, then uninstall: `pip install <package> --force-reinstall --no-deps` followed by `pip uninstall <package> -y`
    Reinstall the package in non-editable mode first, then uninstall: `pip install <package> --force-reinstall --no-deps` followed by `pip uninstall <package> -y`
  2. 90% success Use `pip uninstall <package> -y` with the exact editable path from `pip show <package>` (e.g., `pip uninstall -e /path/to/project`). Example: `pip uninstall -e /home/user/myproject`
    Use `pip uninstall <package> -y` with the exact editable path from `pip show <package>` (e.g., `pip uninstall -e /path/to/project`). Example: `pip uninstall -e /home/user/myproject`

中文步骤

  1. 首先以非可编辑模式重新安装包,然后卸载:`pip install <package> --force-reinstall --no-deps` 接着 `pip uninstall <package> -y`
  2. 使用来自 `pip show <package>` 的确切可编辑路径运行 `pip uninstall <package> -y`(例如 `pip uninstall -e /home/user/myproject`)。示例:`pip uninstall -e /home/user/myproject`

Dead Ends

Common approaches that don't work:

  1. 95% fail

    The flag only affects dependency resolution, not the uninstall target itself; pip still checks if the package is installed as editable.

  2. 80% fail

    The editable install is a symlink or .pth file, not a full copy; deleting the directory leaves the .pth file, causing pip to still see the package as installed.