Why did Flask start failing with “ImportError: cannot import name ‘url_quote’ from ‘werkzeug.urls'”?

I had the same problem. It is because Werkzeug 3.0.0 was released and Flask doesn’t specify the dependency correctly (requirements says Werkzeug>=2.2.0). This is why, Werkzeug 3.0.0 is still installed and Flask 2.2.2 isn’t made for Werkzeug 3.0.0.

Solution: Just set a fix version for Werkzeug such as Werkzeug==2.2.2 in your requirements.txt and it should work.

Leave a Comment