Installation problem ERPNext v13 (Jinja2)

Hello,
I was trying to set up another instance of ERPnext in a new server. I tried to install multiple times after coming across this error, but get the same error every single time.

System: Ubuntu 20.04
8 GB RAM, 4 core cpu @ Linode

I follow this tutorial to install Erpnext. But I install v13 instead of v12 as described in that link.

Error
Error occurs after this step:

The following is the console screen after running this step.

When I try to open up site in browser, I get no response from server.

sudo supervisorctl start all

This command doesnot work. It says supervisorctl command not found.

Running the command sudo bench setup production sammy --yes again gives this error.

Can anyone help me solve the problem ?

I followed this tutorial some time ago and got stuck at this same point. Then i saw this thread and i have used it to install multiple times ever since without a single error. Give it a try.

Surely will check the link.

But the thing that bugs me is, I already have installed ERPNext v13 two or three times using that tutorial a few months ago. It worked just fine back then. Could the error be because of updated python and other dependencies ? If that’s the case, it would definitely be problematic every other month when a new dependency gets an update in apt repository.

It could be, but the tutorial in that thread is future-proof from what I have come to realize so far. I’ve used it to install v13 and v14 and just yesterday I used it to install v14 on Ubuntu 22.04 with python 3.10 and didn’t encounter any errors. I routinely create new installs to ensure setup is always going to be possible if I need to perform disaster recovery on my production instance so I try different installation options all the time. So far this one has proven reliable multiple times and so I haven’t tried any other option for months.

Please install requirement dependency.

sudo pip3 install markupsafe==2.0.1

I had tried that as well. It did not solve the problem.

Looks like the problem is with ansible, ansible core version and jinja version.

I could not solve it. I will now try the method suggested by @flexy2ky

I got stuck with that method you suggested as well.

Error appeared after this step:

sudo pip3 install frappe-bench

This is the terminal output after running the above step.

anupd@localhost:~$ sudo pip3 install frappe-bench
Collecting frappe-bench
  Downloading frappe_bench-5.12.1-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 55.2 MB/s
Collecting tomli; python_version < "3.11"
  Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting python-crontab~=2.4.0
  Downloading python-crontab-2.4.2.tar.gz (52 kB)
     |████████████████████████████████| 52 kB 4.4 MB/s
Collecting Jinja2~=3.0.3
  Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 126.7 MB/s
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from frappe-bench) (2.22.0)
Collecting GitPython~=2.1.15
  Downloading GitPython-2.1.15-py2.py3-none-any.whl (452 kB)
     |████████████████████████████████| 452 kB 109.9 MB/s
Requirement already satisfied: Click>=7.0 in /usr/lib/python3/dist-packages (from frappe-bench) (7.0)
Collecting semantic-version~=2.8.2
  Downloading semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
Collecting honcho
  Downloading honcho-1.1.0-py2.py3-none-any.whl (21 kB)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from frappe-bench) (45.2.0)
Collecting python-dateutil
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 105.7 MB/s
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting gitdb2<3,>=2
  Downloading gitdb2-2.0.6-py2.py3-none-any.whl (63 kB)
     |████████████████████████████████| 63 kB 13.6 MB/s
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil->python-crontab~=2.4.0->frappe-bench) (1.14.0)
Collecting smmap2>=2.0.0
  Downloading smmap2-3.0.1-py3-none-any.whl (1.1 kB)
Collecting smmap>=3.0.1
  Downloading smmap-5.0.0-py3-none-any.whl (24 kB)
Building wheels for collected packages: python-crontab
  Building wheel for python-crontab (setup.py) ... done
  Created wheel for python-crontab: filename=python_crontab-2.4.2-py3-none-any.whl size=25449 sha256=72e3e53d31dbc126b67d805c5d8a312dc6daa2d43bd79334fd510d1276b3eefc
  Stored in directory: /root/.cache/pip/wheels/7e/d2/c6/2de53d89e6569b9af633d83f2a76474150dddef6d15a634846
Successfully built python-crontab
Installing collected packages: tomli, python-dateutil, python-crontab, MarkupSafe, Jinja2, smmap, smmap2, gitdb2, GitPython, semantic-version, honcho, frappe-bench
  Attempting uninstall: MarkupSafe
    Found existing installation: MarkupSafe 1.1.0
    Not uninstalling markupsafe at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'MarkupSafe'. No files were found to uninstall.
  Attempting uninstall: Jinja2
    Found existing installation: Jinja2 2.10.1
    Not uninstalling jinja2 at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'Jinja2'. No files were found to uninstall.
Successfully installed GitPython-2.1.15 Jinja2-3.0.3 MarkupSafe-2.1.1 frappe-bench-5.12.1 gitdb2-2.0.6 honcho-1.1.0 python-crontab-2.4.2 python-dateutil-2.8.2 semantic-version-2.8.5 smmap-5.0.0 smmap2-3.0.1 tomli-2.0.1

FYI:
I got a running system installed with this guide:

I tried to install ERPNext multiple times with the link you provided. Sometimes it failed and sometimes it worked.
This time I tried installing it in WSL in windows 10. It got all running until I got this error.

When I run bench start and then refresh the page, I get this error in browser:

pymysql.err.OperationalError

pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)")

## Traceback *(most recent call last)*

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line *613*, in `connect`

sock = socket.create_connection(

* #### File "/usr/lib/python3.8/socket.py", line *808*, in `create_connection`

raise err

* #### File "/usr/lib/python3.8/socket.py", line *796*, in `create_connection`

sock.connect(sa)

* During handling of the above exception, another exception occurred:

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/app.py", line *55*, in `application`

init_request(request)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/app.py", line *130*, in `init_request`

frappe.local.http_request = frappe.auth.HTTPRequest()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/auth.py", line *37*, in `__init__`

self.set_session()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/auth.py", line *74*, in `set_session`

frappe.local.login_manager = LoginManager()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/auth.py", line *130*, in `__init__`

self.make_session(resume=True)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/auth.py", line *215*, in `make_session`

frappe.local.session_obj = Session(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/sessions.py", line *215*, in `__init__`

self.resume()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/sessions.py", line *287*, in `resume`

validate_ip_address(self.user)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/auth.py", line *419*, in `validate_ip_address`

frappe.get_cached_doc("User", user) if not frappe.flags.in_test else frappe.get_doc("User", user)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/__init__.py", line *1020*, in `get_cached_doc`

doc = get_doc(*args, **kwargs)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/__init__.py", line *1074*, in `get_doc`

doc = frappe.model.document.get_doc(*args, **kwargs)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/model/document.py", line *77*, in `get_doc`

controller = get_controller(doctype)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/model/base_document.py", line *78*, in `get_controller`

return _get_controller()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/model/base_document.py", line *43*, in `_get_controller`

module_name, custom = frappe.db.get_value(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *459*, in `get_value`

ret = self.get_values(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *531*, in `get_values`

out = self._get_values_from_table(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *726*, in `_get_values_from_table`

r = self.sql(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *148*, in `sql`

self.connect()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *84*, in `connect`

self._conn = self.get_connection()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/mariadb/database.py", line *76*, in `get_connection`

conn = pymysql.connect(

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line *353*, in `__init__`

self.connect()

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line *664*, in `connect`

raise exc

* During handling of the above exception, another exception occurred:

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line *613*, in `connect`

sock = socket.create_connection(

* #### File "/usr/lib/python3.8/socket.py", line *808*, in `create_connection`

raise err

* #### File "/usr/lib/python3.8/socket.py", line *796*, in `create_connection`

sock.connect(sa)

* During handling of the above exception, another exception occurred:

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/middlewares.py", line *18*, in `__call__`

return super(StaticDataMiddleware, self).__call__(environ, start_response)

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py", line *220*, in `__call__`

return self.app(environ, start_response)

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py", line *220*, in `__call__`

return self.app(environ, start_response)

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/werkzeug/local.py", line *231*, in `application`

return ClosingIterator(app(environ, start_response), self.cleanup)

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/werkzeug/wrappers/base_request.py", line *237*, in `application`

resp = f(*args[:-2] + (request,))

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/app.py", line *90*, in `application`

response = handle_exception(e)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/app.py", line *290*, in `handle_exception`

response = frappe.website.render.render("message", http_status_code=http_status_code)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/website/render.py", line *45*, in `render`

raise_if_disabled(path)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/website/render.py", line *413*, in `raise_if_disabled`

routes = frappe.db.get_all(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *633*, in `get_all`

return frappe.get_all(*args, **kwargs)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/__init__.py", line *1741*, in `get_all`

return get_list(doctype, *args, **kwargs)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/__init__.py", line *1713*, in `get_list`

return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/model/db_query.py", line *164*, in `execute`

self.columns = self.get_table_columns()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/model/db_query.py", line *429*, in `get_table_columns`

return get_table_columns(self.doctype)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/model/meta.py", line *63*, in `get_table_columns`

return frappe.db.get_table_columns(doctype)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *1081*, in `get_table_columns`

columns = self.get_db_table_columns("tab" + doctype)

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *1065*, in `get_db_table_columns`

for r in self.sql(

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *148*, in `sql`

self.connect()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/database.py", line *84*, in `connect`

self._conn = self.get_connection()

* #### File "/home/anupd/frappe-bench/apps/frappe/frappe/database/mariadb/database.py", line *76*, in `get_connection`

conn = pymysql.connect(

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line *353*, in `__init__`

self.connect()

* #### File "/home/anupd/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line *664*, in `connect`

raise exc

> pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)")

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

* `dump()` shows all variables in the frame
* `dump(obj)` dumps all that's known about the object

Brought to you by **DON'T PANIC**, your friendly Werkzeug powered traceback interpreter.

Which command did you execute and which user did you use to execute the command. Also confirm the mariadb version installed.

I followed this step by step guide as you suggested. I followed upto
bench --site site1.local enable-scheduler. Then reboot the wsl.

Mariadb version is 10.3.34