ImportError: cannot import name ‘escape’ from ‘jinja2’

Jinja is a dependency of Flask and Flask V1.X.X uses the escape module from Jinja, however recently support for the escape module was dropped in newer versions of Jinja.

To fix this issue, simply update to the newer version of Flask V2.X.X in your requirements.txt where Flask no longer uses the escape module from Jinja.

Flask>=2.2.2

Also, do note that Flask V1.X.X is no longer supported by the team. If you want to continue to use this older version, this Github issue may help.

Leave a Comment