pip "error: command 'gcc' failed: No such file or directory" in CI
A package needed to compile a C extension, but gcc is not on the runner. setuptools tried to spawn the compiler, the OS could not find the executable, and the build aborted.
What this error means
The wheel or install build fails with "error: command 'gcc' failed: No such file or directory" (or "'cc' failed"). The runner image lacks a C toolchain.
pip
building 'frozenlist._frozenlist' extension
error: command 'gcc' failed: No such file or directoryCommon causes
No build toolchain on the runner
Slim base images (alpine, slim Debian) ship without gcc, so any source compile fails immediately.
A source build was forced unnecessarily
A version pin or --no-binary made pip compile instead of using an available wheel, exposing the missing compiler.
How to fix it
Install a C toolchain before the build
- Add the build-essential / gcc package for your base image.
- Re-run the install so the compiler is available.
Terminal
# Debian/Ubuntu
sudo apt-get update && sudo apt-get install -y build-essential
# Alpine
apk add --no-cache build-baseUse a wheel instead of compiling
If a binary wheel exists, install it and skip the compiler requirement.
Terminal
pip install --only-binary=:all: frozenlistHow to prevent it
- Install build-essential in CI images that compile source packages.
- Prefer binary wheels for compiled dependencies.
- Pick a base image that already includes a toolchain when you build frequently.
Related guides
pip "fatal error: Python.h: No such file or directory" in CIFix "fatal error: Python.h: No such file or directory" in CI - the Python development headers (python3-dev) a…
pip "Building wheel for X did not run successfully" (Cython) in CIFix "Building wheel for X did not run successfully" with a Cython error in CI - the .pyx compilation step fai…
pip "Microsoft Visual C++ 14.0 / gcc required" build error in CIFix pip "error: Microsoft Visual C++ 14.0 or greater is required" (Windows) or "gcc: command not found" (Linu…