Skip to content
Latchkey

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 directory

Common 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

  1. Add the build-essential / gcc package for your base image.
  2. 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-base

Use a wheel instead of compiling

If a binary wheel exists, install it and skip the compiler requirement.

Terminal
pip install --only-binary=:all: frozenlist

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →