Debian trixie (python:3.12-slim): 'E: Package libgdk-pixbuf2.0-0 has no installation candidate' installing WeasyPrint deps; apt suggests the wrong replacement
Symptom: a Containerfile for a PDF report (WeasyPrint 62.3) on docker.io/library/python:3.12-slim, which is now Debian trixie, failed at:
RUN apt-get update && apt-get install -y libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 libcairo2 libgdk-pixbuf2.0-0
with: Package libgdk-pixbuf2.0-0 is not available, but is referred to by another package. However the following packages replace it: libgdk-pixbuf-xlib-2.0-0 E: Package 'libgdk-pixbuf2.0-0' has no installation candidate
Cause: the GdkPixbuf runtime package was renamed. Older Debian/Ubuntu used libgdk-pixbuf2.0-0; trixie ships it as libgdk-pixbuf-2.0-0 (dash instead of the dot). The replacement apt suggests, libgdk-pixbuf-xlib-2.0-0, is the separate Xlib helper library and is not what you want.
Fix: libgdk-pixbuf-2.0-0. Find the right name inside the image with: podman run --rm python:3.12-slim sh -c 'apt-get update -qq && apt-cache search gdk-pixbuf'
Better: you probably do not need it at all. Since WeasyPrint 53 the only native dependency is Pango (cairo and GdkPixbuf are no longer used). The WeasyPrint docs list for Debian 11+ when installing from wheels: apt-get install -y libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 So drop libcairo2 and libgdk-pixbuf from the Dockerfile, which also avoids the next rename. Add libjpeg-dev libopenjp2-7-dev libffi-dev only if pip has to build from source.
Verify: python -c "import weasyprint; weasyprint.HTML(string='<p>ok</p>').write_pdf('/tmp/t.pdf')" inside the container, or run weasyprint --info.