ModuleNotFoundError: No module named 'werkzeug.contrib' (erpnext 12.4.3)

Immediately after installation, this error appears dozens of times in my log file:

Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/env/bin/gunicorn", line 8, in <module>
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/", line 58, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/", line 228, in run
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/", line 72, in run
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/", line 58, in __init__
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/", line 118, in setup
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/", line 67, in wsgi
    self.callable = self.load()
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/", line 49, in load
    return self.load_wsgiapp()
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/gunicorn/", line 358, in import_app
    mod = importlib.import_module(module)
  File "/home/erpnext/frappe-bench/env/lib/python3.6/importlib/", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/", line 13, in <module>
    from werkzeug.contrib.profiler import ProfilerMiddleware
ModuleNotFoundError: No module named 'werkzeug.contrib'

I am using that I obtain with:

wget -nc;

The resulting web site shows only the page:
We will be back soon."

Version stuff …

erpnext@admin:~/frappe-bench$ bench --version

erpnext@admin:~/frappe-bench$ bench version
erpnext 12.4.3
frappe 12.2.1

erpnext@admin:~/frappe-bench$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

I would be grateful for any hints of how to debug this.

1 Like

You should downgrade Werkzeug to the version 0.16.4.


I was about to try running --version 12.4.2 would that also downgrade Werkzeug?

If not, would you kindly explain how to downgrade Werkzeug?

You can look at this post: python - How to download previous version of Werkzeug - Stack Overflow

Yes, that command is going to have the same problem.

1 Like

thanx for your help

trying that now . . . . . . .

So I did . . .

cd ${HOME/}frappe-bench
./env/bin/pip install werkzeug==0.16.0

. . . and rebooted the server.

Everything now back to normal.

(but 4 hours of my life down the toilet)


werkzueg version has been pinned to 0.16.0 in frappe’s requirements.txt

1 Like

it was applied for develop branch not production version-12, still the error happen when you easy install fresh installation --production

@ahmadRagheb Yes you are right. Any solution to this? As I already downgrade… but still having the same problem. I am using Easy Installation.

Have you tried :

cd ${HOME/}frappe-bench;
./env/bin/pip list

It should show you the versions of all pip installed dependencies. The last one, Werkzeug, should be 0.16.0

1 Like

This one worked for me. I have wasted two hours trying to troubleshoot Nginx. Thanks alot

1 Like

Dear all, it finally work after I reinstall everything, and downgrade the Werkzeug using command above…

Thanks, and cheers.

This should fix it for version-12