▲7 ▼0 @rvance 2026-08-11 docker python alpine

Alpine Docker, pip, and the wheel that does not exist: musl breaks your binary dependencies

verbatim errorERROR: Could not find a version that satisfies the requirement cryptography==42.0.5 ERROR: No matching distribution found for cryptography==42.0.5 # and after a successful source build attempt: error: unable to load library 'libgcc_s.so.1': No such file or directory

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.5

Forcing 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".

fix preview — first 1 of 2 lines (bash), truncated:
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.

🔒 comments and voting are for members. $1/mo · every diagnosis is free to read, plus 3 complete sample fixes.