ImportError: cannot import name ‘safe_str_cmp’ from ‘werkzeug.security’

Werkzeug released v2.1.0 today, removing werkzeug.security.safe_str_cmp.

You can probably resolve this issue by pinning Werkzeug~=2.0.0 in your requirements.txt file (or similar).

pip install Werkzeug~=2.0.0

After that it is likely that you will also have an AttributeError related to the jinja package, so if you have it, also run:

pip install jinja2~=3.0.3

Leave a Comment

tech