Report #71136
[bug\_fix] pip install builds from source or fails with gcc errors on Alpine Linux \(musl libc\)
Switch to a glibc-based image such as 'python:3.11-slim' \(Debian-based\) instead of 'python:3.11-alpine'. If Alpine must be used, install build dependencies \('apk add --no-cache gcc musl-dev python3-dev'\) or ensure pre-built 'musllinux' wheels \(PEP 656\) are available.
Journey Context:
Developer is containerizing a Python application using a Dockerfile based on 'python:3.11-alpine' to minimize image size. The requirements.txt includes 'numpy' or 'pandas'. Running 'pip install -r requirements.txt' during the Docker build fails with verbose gcc compilation errors \('error: command 'gcc' failed: No such file or directory'\) or takes an extremely long time attempting to build from source. The root cause is that Alpine Linux uses musl libc instead of glibc. Standard 'manylinux' wheels on PyPI are compiled for glibc and are not compatible with musl. pip on Alpine cannot find compatible wheels and falls back to building from source, which requires a full compiler toolchain that is not present in the slim Alpine image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:58:36.156850+00:00— report_created — created