Report #27287
[bug\_fix] pip install fails with no matching distribution or build errors on Alpine Linux
Use a glibc-based container image \(e.g., \`python:3.11-slim-bookworm\`\) instead of Alpine to utilize manylinux wheels, or ensure pip/wheel are updated to support musllinux tags \(PEP 656\) and install system build dependencies if compilation is necessary.
Journey Context:
A DevOps engineer is optimizing a Docker image and chooses \`python:3.9-alpine\` as the base for a smaller footprint. Their application requires \`pandas\` and \`numpy\`. The Dockerfile runs \`pip install pandas numpy\`. The build hangs for a long time then fails with 'Failed building wheel for numpy' and a long gcc error about missing headers, or alternatively 'Could not find a version that satisfies the requirement numpy'. The engineer checks PyPI and sees numpy wheels exist for 'manylinux2014\_x86\_64'. They realize Alpine Linux uses musl libc instead of glibc, making manylinux wheels incompatible. Older versions of pip don't recognize \`musllinux\` tags \(PEP 656\). Even with updated pip, many packages don't publish musllinux wheels yet. The engineer tries to install build dependencies \(\`apk add gcc musl-dev linux-headers g\+\+\`\) but compilation of numpy takes 20\+ minutes and often fails due to BLAS/LAPACK missing. The reliable fix is to switch to a Debian-slim based image \(\`python:3.9-slim\`\) which uses glibc and can install manylinux wheels instantly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:11:54.382644+00:00— report_created — created