'Python container import error on k8s but not locally

ImportError: cannot import name 'Markup' from 'jinja2.utils' (/usr/local/lib/python3.8/site-packages/jinja2/utils.py)

This error started appearing after a recent deployment to K8s. However building the image and running the container locally(Both on Windows and Linux machines) using docker-compose produces no errors.

The image K8s uses is hosted in aws ECR, strangely I am unable to reproduce the error by pulling this image and running it locally. It works exactly as expected. There doesn't seem to be any issue with the image itself.

The code where jinjasql is used hasn't changed either.

I am at a loss as to how this is occurring, any ideas would be appreciated.

Python version is 3.8. Kubernetes 1.21.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source