Frappe-web won't start

I want to install ERPNext on a VM (Compute Engine, Ubuntu 18.04). I used the “Easy Install Script” from Github.

sudo apt-get install python3-minimal build-essential python3-setuptools
export LC_ALL=C.UTF-8
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python3 install.py --production

However frappe-web fails to start. Here is the log:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/bin/gunicorn", line 8, in <module>
    sys.exit(run())
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/base.py", line 228, in run
    super().run()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/arbiter.py", line 58, in __init__
    self.setup(app)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/arbiter.py", line 118, in setup
    self.app.wsgi()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
    return self.load_wsgiapp()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
    mod = importlib.import_module(module)
  File "/home/frappe/frappe-bench/env/lib/python3.6/importlib/__init__.py", 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/frappe/frappe-bench/apps/frappe/frappe/app.py", line 13, in <module>
    from werkzeug.contrib.profiler import ProfilerMiddleware
ModuleNotFoundError: No module named 'werkzeug.contrib' 

When I access the page from the browser, I get the 502 Bad Gateway response (Sorry!
We will be back soon.)

The very strange part is, that I used the exact same commands on the exact same host OS on a different VM a few days ago and it just worked perfectly. The checksum of the install script are the same as well as the bench, frappe and ERPNext versions. I tried manually installing “Werkzeug” via pip, which also didn’t help.

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

Already tried (as written in my post), didn’t work.

What you describe is precisely what I experienced.

“The very strange part is, that I used the exact same commands on the exact same host OS on a different VM a few days ago and it just worked perfectly.”

Yes! Me too! Werkzeug has decided that contrib should go in a separate module :

There are broken projects all over the web that have not locked their werkzeug version to 0.16.x


" I tried manually installing “Werkzeug” via pip, which also didn’t help."

It is not clear from that statement what command you actually ran.

If you just go to some random directory and run pip …

cd ${HOME}
pip install werkzeug

… you will not succeed.

It is necessary to be inside the bench virtual environment. Please try …

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

(that assumes you installed frappe-bench in that location)

5 Likes

Thanks, now it works! I thought, that pip installs the module globally.

Werkzeug has decided that contrib should go in a separate module

So this happened a few days ago, didn’t it? What a coincidence, I spend hours trying to find what I did different on the first installation… :sleepy:

Yup, cost me many hours.

Worse, it follows on losing a whole long day several weeks ago on … Cannot run Cypress on Ubuntu 18.04

That had nothing to do with ErpNext, but it was another whole day going, “wtf have I done wrong now!!! GOD am I ever stupid!! I should find another line of work. :woozy_face:

1 Like

It works.

Fixed in frappe#9471 and will be a part of the next release

1 Like