ImportError: cannot import name ‘parse_rule’ from ‘werkzeug.routing’

Total
0
Shares

To resolve ImportError: cannot import name ‘parse_rule’ from ‘werkzeug.routing’, you need to downgrade flask and werkzeug library.

Solution

1. Open your requirements.txt file

2. Add werkzeug<=2.1.2 to it. The file will look like this –

Flask~=2.1.2
psycopg2-binary==2.9.3
Flask-SQLAlchemy==2.5.1
flask-restx==0.5.1
qrcode~=7.3.1
PyPDF2==2.6.0
reportlab~=3.6.10
WTForms~=3.0.1
flask-bootstrap==3.3.7.1
flask-wtf==1.0.1
werkzeug<=2.1.2

3. Downgrade flask as well to make it compatible to werkzeug version –

flask == 2.1.2   
flask-restx >= 0.5.1

That’s it. This will solve your ImportError: cannot import name ‘parse_rule’ from issue