Endless import of matplotlib in Lambda Container: Matplotlib is building the font cache; this may take a moment

Viewed 91

I am using the following Docker Image as a Lambda Container. When I invoke the Container, it exceeds the time limit of 15 min because of the matplotlib import building the font cache. I tried all the tips provided to this issue on Stack Overflow but it is not working. Does anybody know some ways to solve this problem? My matplotlib version is 3.5.1

FROM public.ecr.aws/lambda/python:3.7

COPY . /var/task/

RUN pip install -r /var/task/requirements.txt
#ENV MPLCONFIGDIR = /tmp
RUN rm -rf ~/.cache/matplotlib
RUN rm -rf /root/.cache/matplotlib
#RUN pip uninstall -y matplotlib

CMD ["my_handler.lambda_handler"]

Many thanks in advance!

0 Answers
Related