Try ERPNext Buy Support Partners Foundation

Easy Install is definitely bugged on Ubuntu 18.04

Chain of commands:

sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo adduser erpnext
usermod -aG sudo erpnext
su erpnext
cd
sudo -H apt-get install python3-setuptools python3-minimal redis-server build-essential
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo -H python3 install.py --production --user erpnext

Error:

fatal: [localhost]: FAILED! => {
"changed": true,
"cmd": [
    "bench",
    "new-site",
    "site1.local",
    "--admin-password",
    "admin",
    "--mariadb-root-password",
    "password"
],
"delta": "0:00:26.974592",
"end": "2019-11-11 00:17:58.033734",
"invocation": {
    "module_args": {
        "_raw_params": "bench new-site site1.local --admin-password 'admin' --mariadb-root-password 'password'",
        "_uses_shell": false,
        "argv": null,
        "chdir": "/home/frappe/frappe-bench",
        "creates": null,
        "executable": null,
        "removes": null,
        "stdin": null,
        "stdin_add_newline": true,
        "strip_empty_ends": true,
        "warn": true
    }
},
"msg": "non-zero return code",
"rc": 1,
"start": "2019-11-11 00:17:31.059142",
"stderr": "Traceback (most recent call last):\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 484, in connect\n    sock = self._connect()\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 541, in _connect\n    raise err\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 529, in _connect\n    sock.connect(socket_address)\nConnectionRefusedError: [Errno 111] Connection refused\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2879, in execute\n    return execute(conn, stack, raise_on_error)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2749, in _execute_transaction\n    connection.send_packed_command(all_cmds)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 585, in send_packed_command\n    self.connect()\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 489, in connect\n    raise ConnectionError(self._error_message(e))\nredis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 484, in connect\n    sock = self._connect()\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 541, in _connect\n    raise err\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 529, in _connect\n    sock.connect(socket_address)\nConnectionRefusedError: [Errno 111] Connection refused\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/lib/python3.6/runpy.py\", line 193, in _run_module_as_main\n    \"__main__\", mod_spec)\n  File \"/usr/lib/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 97, in <module>\n    main()\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 18, in main\n    click.Group(commands=commands)(prog_name='bench')\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 764, in __call__\n    return self.main(*args, **kwargs)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 717, in main\n    rv = self.invoke(ctx)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 1137, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 1137, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 956, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 555, in invoke\n    return callback(*args, **kwargs)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py\", line 32, in new_site\n    db_type=db_type)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py\", line 73, in _new_site\n    _install_app(app, verbose=verbose, set_as_patched=not source_sql)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/installer.py\", line 92, in install_app\n    frappe.get_attr(after_install)()\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py\", line 19, in after_install\n    install_basic_docs()\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py\", line 77, in install_basic_docs\n    frappe.get_doc(d).insert()\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 259, in insert\n    self.run_post_save_methods()\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 919, in run_post_save_methods\n    self.run_method(\"on_update\")\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 787, in run_method\n    out = Document.hook(fn)(self, *args, **kwargs)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 1058, in composer\n    return composed(self, method, *args, **kwargs)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 1041, in runner\n    add_to_return_value(self, fn(self, *args, **kwargs))\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 781, in <lambda>\n    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py\", line 93, in on_update\n    self.share_with_self()\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py\", line 177, in share_with_self\n    flags={\"ignore_share_permission\": True})\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/share.py\", line 44, in add\n    notify_assignment(user, doctype, name, everyone)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/share.py\", line 171, in notify_assignment\n    enqueue_create_notification(shared_by, notification_doc)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/desk/doctype/notification_log/notification_log.py\", line 38, in enqueue_create_notification\n    now=frappe.flags.in_test\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py\", line 1475, in enqueue\n    return frappe.utils.background_jobs.enqueue(*args, **kwargs)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py\", line 69, in enqueue\n    kwargs=queue_args)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/queue.py\", line 258, in enqueue_call\n    job = self.enqueue_job(job, at_front=at_front)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/queue.py\", line 331, in enqueue_job\n    pipe.execute()\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2894, in execute\n    return execute(conn, stack, raise_on_error)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2749, in _execute_transaction\n    connection.send_packed_command(all_cmds)\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 585, in send_packed_command\n    self.connect()\n  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 489, in connect\n    raise ConnectionError(self._error_message(e))\nredis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.",
"stderr_lines": [
    "Traceback (most recent call last):",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 484, in connect",
    "    sock = self._connect()",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 541, in _connect",
    "    raise err",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 529, in _connect",
    "    sock.connect(socket_address)",
    "ConnectionRefusedError: [Errno 111] Connection refused",
    "",
    "During handling of the above exception, another exception occurred:",
    "",
    "Traceback (most recent call last):",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2879, in execute",
    "    return execute(conn, stack, raise_on_error)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2749, in _execute_transaction",
    "    connection.send_packed_command(all_cmds)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 585, in send_packed_command",
    "    self.connect()",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 489, in connect",
    "    raise ConnectionError(self._error_message(e))",
    "redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.",
    "",
    "During handling of the above exception, another exception occurred:",
    "",
    "Traceback (most recent call last):",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 484, in connect",
    "    sock = self._connect()",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 541, in _connect",
    "    raise err",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 529, in _connect",
    "    sock.connect(socket_address)",
    "ConnectionRefusedError: [Errno 111] Connection refused",
    "",
    "During handling of the above exception, another exception occurred:",
    "",
    "Traceback (most recent call last):",
    "  File \"/usr/lib/python3.6/runpy.py\", line 193, in _run_module_as_main",
    "    \"__main__\", mod_spec)",
    "  File \"/usr/lib/python3.6/runpy.py\", line 85, in _run_code",
    "    exec(code, run_globals)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 97, in <module>",
    "    main()",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 18, in main",
    "    click.Group(commands=commands)(prog_name='bench')",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 764, in __call__",
    "    return self.main(*args, **kwargs)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 717, in main",
    "    rv = self.invoke(ctx)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 1137, in invoke",
    "    return _process_result(sub_ctx.command.invoke(sub_ctx))",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 1137, in invoke",
    "    return _process_result(sub_ctx.command.invoke(sub_ctx))",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 956, in invoke",
    "    return ctx.invoke(self.callback, **ctx.params)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py\", line 555, in invoke",
    "    return callback(*args, **kwargs)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py\", line 32, in new_site",
    "    db_type=db_type)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py\", line 73, in _new_site",
    "    _install_app(app, verbose=verbose, set_as_patched=not source_sql)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/installer.py\", line 92, in install_app",
    "    frappe.get_attr(after_install)()",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py\", line 19, in after_install",
    "    install_basic_docs()",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py\", line 77, in install_basic_docs",
    "    frappe.get_doc(d).insert()",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 259, in insert",
    "    self.run_post_save_methods()",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 919, in run_post_save_methods",
    "    self.run_method(\"on_update\")",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 787, in run_method",
    "    out = Document.hook(fn)(self, *args, **kwargs)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 1058, in composer",
    "    return composed(self, method, *args, **kwargs)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 1041, in runner",
    "    add_to_return_value(self, fn(self, *args, **kwargs))",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py\", line 781, in <lambda>",
    "    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py\", line 93, in on_update",
    "    self.share_with_self()",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py\", line 177, in share_with_self",
    "    flags={\"ignore_share_permission\": True})",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/share.py\", line 44, in add",
    "    notify_assignment(user, doctype, name, everyone)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/share.py\", line 171, in notify_assignment",
    "    enqueue_create_notification(shared_by, notification_doc)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/desk/doctype/notification_log/notification_log.py\", line 38, in enqueue_create_notification",
    "    now=frappe.flags.in_test",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py\", line 1475, in enqueue",
    "    return frappe.utils.background_jobs.enqueue(*args, **kwargs)",
    "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py\", line 69, in enqueue",
    "    kwargs=queue_args)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/queue.py\", line 258, in enqueue_call",
    "    job = self.enqueue_job(job, at_front=at_front)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/queue.py\", line 331, in enqueue_job",
    "    pipe.execute()",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2894, in execute",
    "    return execute(conn, stack, raise_on_error)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/client.py\", line 2749, in _execute_transaction",
    "    connection.send_packed_command(all_cmds)",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 585, in send_packed_command",
    "    self.connect()",
    "  File \"/home/frappe/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py\", line 489, in connect",
    "    raise ConnectionError(self._error_message(e))",
    "redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused."

I tried performing the install manually, and noticed that when I have two SSH windows open (one with bench start running, and the other to create the bench site), at some point bench dies out which causes the bench site creation to give the same error (connection to host refused). I probably can circumvernt that by starting bench again and creating site, but I wonder why easy install fails.

I attempted this installation on a VPS as well as on my own machine, with identical errors.

Your problem is related to the redis server, EIther it is not installed or not started. You will have to check the logs. Also try starting redis server in another window as root.

sudo service redis-server start

Definitely not if some of us can install using Easy Install…

Hi Tufan,

Seems the issue is related to a very recent Ubuntu update. Looking at Easy Install guide not working , there are two posts (one from a person that successfully performed the install a month ago, and the other from a person that completed the install just 2 weeks ago) and both are now having the same error that I do.

When this error is encountered, purging the redis and reinstalling worked for some people. Since it is an OS bug, I do not think that the Easy Install has any errors. It executed very basic tasks IMHO

Understood, thank you for your insight.

Generally speaking, did you find Ubuntu a better distro for ERPNext, or CentOS? I’m contemplating between the two right now (even though the script doesn’t yet accept CentOS 8)…

I am more experienced on Ubuntu and did not try it on another distro.

I am using Ubuntu 18.04 also. I hit these errors. It has something to do with redis server responsible for socketio not being able to access PID file. Using bench commands, I am able to finish installation.

Personally, I think easy install is the safest way to install because there are many things that will be missed in manual installation. (I realized this after going over the installation code.

I use python 2.7 because that is what easy install expects.

I don’t do sudo apt update and upgrade because it creates problems during installation.

sudo apt install python-minimal is enough. Easy install does the rest.

When you hit this Error 111 thing, turn off supervisor, redis, and nginx. You do this by

 sudo service supervisor stop
 sudo service redis stop
 sudo service nginx stop

In another terminal, (Use another putty or ssh connection) start bench in develop mode

 sudo bench start

The output of this terminal will show you if redis goes through. (Sometimes there is the ENOSPC error to watch out for. You will also notice that redis may complain about not being able to set the required parameters. This can be repaired by using nano editor and putting in correct configuration files – which is more related to redis and not erpnext. If you need these, I can also share this with you.)

If you notice in the error message, you are already in the new-site portion. So, we continue the process by reinstall (assuming that the bench start messages does not have any errors.)

 sudo bench --site site1.local reinstall
 sudo bench --site site1.local install-app erpnext

at this point, you can access the installation using web browse (http://site1.local:8000)

  • of course you have to set your /etc/hosts to have 127.0.0.1 site1.local both on your Ubuntu server, and also on your client computer (assuming you may be using windows).

Then when you have setup erpnext using the web browser, you can stop the bench start terminal by using ctrl-c to get back to the prompt level.

Start the production mode.

 sudo supervisor supervisor start
 sudo supervisor redis start
 sudo supervisor nginx start
 sudo systemctl reload nginx
 
 bench restart

Often, Easy install does not go through because of OS settings. I am thankful that Frappe has Bench commands that can resolve the issues, if one knows what they do.

2 Likes

Really thoughtful response!! Thank you!

Worked like a charm. I really need to get my self a primer on all the bench and supervisor commands. They seem super essential to run a decent erpnext setup!

Now I’m at the erpnext setup phase (just before production). I edited /etc/hosts and included 127.0.0.1 site1.local
Issue I have is I can’t access my ERP via the VPS’s IP address (bench gives an error saying x.x.x.x does not exist). Similarly, on the VPS itself, I can’t lynx 127.0.0.1:8000, but I can lynx site1.local:8000 . I have read guidance on how to attach a subdomain to the ERPNext (once I’m approaching production), but for now how can I access it via the VPS’s IP address?

Similarly, how can I access bench manager via the VPS’s ip address ( and on what port? )

Thank you once again.

1 Like

I think it might be a good idea to put this in a separate Topic specific to the specific problem (accessing your running instance) rather then discussing all upcoming problem of your instance in one single Topic.

You have the option to start the production mode and setup the erpnext using the browser. (Meaning, reverse the last two processes: ctrl-c the bench start, do the start production mode set, and setup erpnext on the web brower - this means you are already in production mode).

You are correct in noticing that in bench start (develop mode), bench complains if you use the actual ip address. You have to use the domain name. If you want to use another domain name instead of site1.local, you may use the mv command, at frappe-bench directory: (Please note that this is develop mode activated by bench start).

 sudo mv sites/site1.local sites/mydomain.com

the directory name in your sites directory should be the same as your domain name.

To access this site on the browser:

 http://mydomain.com:8000

One thing I like setting up erpnext while on the develop mode is that it does not time-out. Sometimes, in production mode, the setup stops before it completes.

(On production mode, you don’t need the :8000 port)