error pip build_error ai_generated true

error: legacy-install-failure × Encountered error while trying to install package. ╰─> numpy note: This is an issue with the package mentioned above, not pip. hint: See the output of 'pip debug --verbose' for an overview of the current compatibility.

ID: pip/legacy-setup-py-install-error

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.3+ active
numpy <1.20 active
Python 3.10 active

Root Cause

Pip's legacy setup.py install path failed because the package (e.g., numpy) uses an outdated build system that is incompatible with the current pip or Python version, often due to missing compiler toolchain or unsupported build flags.

generic

中文

Pip 的传统 setup.py 安装路径失败,因为包(例如 numpy)使用了与当前 pip 或 Python 版本不兼容的过时构建系统,通常是由于缺少编译器工具链或不支持的构建标志。

Official Documentation

https://pip.pypa.io/en/stable/topics/backtracking/

Workarounds

  1. 85% success Upgrade the package to a version that supports modern build backends: pip install numpy>=1.20
    Upgrade the package to a version that supports modern build backends: pip install numpy>=1.20
  2. 90% success Use a pre-built wheel if available: pip install --only-binary=:all: numpy
    Use a pre-built wheel if available: pip install --only-binary=:all: numpy
  3. 75% success Install a compatible Python version that still supports the legacy setup.py (e.g., Python 3.8) and use pip<21.0
    Install a compatible Python version that still supports the legacy setup.py (e.g., Python 3.8) and use pip<21.0

中文步骤

  1. 将包升级到支持现代构建后端的版本:pip install numpy>=1.20
  2. 如果可用,使用预构建的 wheel:pip install --only-binary=:all: numpy
  3. 安装仍支持传统 setup.py 的兼容 Python 版本(例如 Python 3.8)并使用 pip<21.0

Dead Ends

Common approaches that don't work:

  1. Reinstalling pip with --upgrade pip 20% fail

    Upgrading pip alone does not fix the underlying build system incompatibility; the issue is with the package's setup.py, not pip itself.

  2. Manually running python setup.py install in the package directory 50% fail

    This bypasses pip but still uses the same broken build system, leading to the same error or different cryptic failures.

  3. Installing with --no-build-isolation flag 40% fail

    This may expose missing system dependencies but does not fix the core setup.py issue; often results in different build errors.