You could also try using a non-slim base image, e.g. python:3.10.0-bullseye
python:3.10.0-bullseye
That sufficed for the latest version of pystan a month ago: