ImportError: cannot import name 'safe_str_cmp' from ''

Any ideas on why I get this error?

My project was working fine. I copied it to an external drive and onto my laptop to work on the road; it worked fine. I copied it back to my desktop and had a load of issues with invalid interpreters etc, so I made a new project and copied just the scripts in, made a new requirements.txt and installed all the packages, but when I run it, I get this error:

Traceback (most recent call last):
  File "E:\Dev\spot_new\flask_blog\", line 1, in <module>
    from flaskblog import app
  File "E:\Dev\spot_new\flask_blog\flaskblog\", line 3, in <module>
    from flask_bcrypt import Bcrypt
  File "E:\Dev\spot_new\venv\lib\site-packages\", line 21, in <module>
    from import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from '' (E:\Dev\spot_new\venv\lib\site-packages\werkzeug\

I've tried uninstalling Python, Anaconda, PyCharm, deleting every reg key and environment variable I can find that looks pythonic, reinstalling all from scratch but still no dice.


  • Werkzeug released v2.1.0 today, removing

    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