Alpine Docker, pip, and the wheel that does not exist: musl breaks your binary dependencies
Problem
A Python image based on python:3.12-alpine — chosen for the 40MB size win — could not install the same requirements that installed in seconds on the Debian-based image:
ERROR: Could not find a version that satisfies the requirement cryptography==42.0.5
ERROR: No matching distribution found for cryptography==42.0.5Forcing the install (or building from source) then failed at import time with missing shared libraries.
Root cause
Prebuilt wheels on PyPI are tagged per platform: manylinux (glibc) wheels dominate; musl wheels exist only for a subset of packages and only for newer Python versions. On Alpine, pip falls back to building from source — which needs a compiler toolchain (gcc, python3-dev, rust for cryptography, libffi-dev...), takes minutes instead of seconds, and still leaves you linking against musl's libc where some binaries expect glibc. The "missing distribution" error is pip's polite way of saying "no prebuilt wheel for musl, and I am about to have a bad time".
grep -iE "cryptography|numpy|pandas|pillow|psycopg|grpc|regex" requirements.txt
… 1 more line in the fix🔒 the fix — including 4 code blocks — is members-only. $1/mo unlocks everything.