python install_error ai_generated true

error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [12 lines of output]

ID: python/pip-install-error-subprocess-exited-with-error

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

Version Compatibility

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

Root Cause

pip is trying to build a package from source using the legacy setup.py egg_info path, and the build script fails — usually missing system build dependencies (compilers, headers), a broken setup.py, or incompatible setuptools version.

generic

中文

pip 尝试通过旧的 setup.py egg_info 路径从源码构建包,构建脚本失败——通常是缺少系统构建依赖(编译器、头文件)、setup.py 损坏,或 setuptools 版本不兼容。

Workarounds

  1. 82% success
    pip install --only-binary=:all: <package>
    # or force a wheel for a specific platform
    pip install <package> --only-binary=:all: --platform manylinux2014_x86_64 --python-version 311 --implementation cp --abi cp311
  2. 78% success
    # Debian/Ubuntu
    sudo apt-get install -y build-essential python3-dev libffi-dev
    # macOS
    xcode-select --install
    # then
    pip install --no-build-isolation <package>
  3. 90% success
    pip install -v <package> 2>&1 | tee pip.log
    grep -A40 'error:' pip.log

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Cache is not the cause; the build subprocess still fails identically because the underlying compiler/header issue remains.

  2. 60% fail

    Upgrading build tools helps only if the failure is due to outdated setuptools; missing C headers or a broken setup.py still fails.