python install_error ai_generated true

error: command 'gcc' failed with exit status 1 building 'foo._speedups' extension

ID: python/setuptools-cython-build-ext-failed

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

A package with C extensions (Cython) is being built from sdist but the compiler toolchain or Python development headers are missing/incompatible, so gcc fails during the extension build.

generic

中文

一个带 C 扩展(Cython)的包正从 sdist 构建,但编译器工具链或 Python 开发头文件缺失/不兼容,导致 gcc 在扩展构建期间失败。

Workarounds

  1. 90% success
    Install a prebuilt wheel: pip install --only-binary=:all: foo  # avoids compilation entirely
  2. 82% success
    Install the toolchain: sudo apt install build-essential python3-dev  # then pip install foo

Dead Ends

Common approaches that don't work:

  1. 65% fail

    Disabling isolation doesn't install gcc or python-dev headers; the compiler is still absent.

  2. 60% fail

    Build tooling versions don't affect the missing system compiler/headers; compilation still fails.