ERPNext-installation-Guide The complete guide to install ERPNext in your Ubuntu system

Thanks @erpnxt_user

1 Like

Dear @erpnxt_user “Bench Update” Not Working.
When i Run “Bench Update” Show the Attached Error. How To Fix this issue and how to recover the backup to restore.

When i run “Bench Start” then show the following Attached error. Showing Updating Error…
Dear Please help in this issue.

Hello,

I don’t know much about backup and restore but for the updating screen, try this:

bench --site [sitename] set-config maintenance_mode 0
bench start

reload your site.

2 Likes

Thank Dear @erpnxt_user for Your Cooperation My Issue Resolved.

1 Like

Hi,

Thank you for your guide but when running bench init frappe-bench --frappe-branch, the command gets stuck in the middle. Any help?

frappe@instance-20220504-1332:~$ bench init frappe-bench --frappe-branch version-13
$ /usr/bin/virtualenv --quiet env -p python3
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-13 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 2985, done.
remote: Counting objects: 100% (2985/2985), done.
remote: Compressing objects: 100% (2667/2667), done.
remote: Total 2985 (delta 431), reused 1159 (delta 246), pack-reused 0
Receiving objects: 100% (2985/2985), 16.34 MiB | 11.07 MiB/s, done.
Resolving deltas: 100% (431/431), done.
Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
$ yarn install
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
[1/3] ⠄ node-sass
[2/3] ⠄ core-js
error /home/frappe/frappe-bench/apps/frappe/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: /home/frappe/frappe-bench/apps/frappe/node_modules/node-sass
Output:
Building: /usr/bin/node /home/frappe/frappe-bench/apps/frappe/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/bin/node',
gyp verb cli   '/home/frappe/frappe-bench/apps/frappe/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@14.19.1 | linux | arm64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:191:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:191:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:191:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:191:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/home/frappe/frappe-bench/apps/frappe/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/frappe/frappe-bench/apps/frappe/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:80:29)
gyp ERR! stack     at /home/frappe/frappe-bench/apps/frappe/node_modules/which/which.js:89:16
gyp ERR! stack     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /home/frappe/frappe-bench/apps/frappe/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:191:21)
gyp ERR! System Linux 5.13.0-1027-oracle
gyp ERR! command "/usr/bin/node" "/home/frappe/frappe-bench/apps/frappe/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/frappe/frappe-bench/apps/frappe/node_modules/node-sass
gyp ERR! node -v v14.19.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok


Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/bench/commands/make.py", line 70, in init
    init(
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/render.py", line 95, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/system.py", line 78, in init
    get_app(
  File "/usr/local/lib/python3.8/dist-packages/bench/app.py", line 371, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/bench/app.py", line 198, in install
    install_app(
  File "/usr/local/lib/python3.8/dist-packages/bench/app.py", line 428, in install_app
    bench.run("yarn install", cwd=app_path)
  File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 43, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/__init__.py", line 126, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]:

Getting error on command “bench --site erp.wecandetect.com install-app erpnext”

erpnext@vps:/home/bench/erpnext$ bench --site erp.wecandetect.com install-app erpnext

Installing erpnext...
An error occurred while installing erpnext: ('Module Def', 'Accounts', IntegrityError(1062, "Duplicate entry 'Accounts' for key 'PRIMARY'"))
Traceback (most recent call last):
  File "apps/frappe/frappe/model/base_document.py", line 400, in db_insert
    frappe.db.sql(
  File "apps/frappe/frappe/database/database.py", line 174, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.8/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "env/lib/python3.8/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.8/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.8/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry 'Accounts' for key 'PRIMARY'")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 293, in install_app
    _install_app(app, verbose=context.verbose)
  File "apps/frappe/frappe/installer.py", line 184, in install_app
    add_module_defs(name)
  File "apps/frappe/frappe/installer.py", line 496, in add_module_defs
    d.save(ignore_permissions=True)
  File "apps/frappe/frappe/model/document.py", line 310, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 332, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 276, in insert
    raise e
  File "apps/frappe/frappe/model/document.py", line 273, in insert
    self.db_insert()
  File "apps/frappe/frappe/model/base_document.py", line 425, in db_insert
    raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: ('Module Def', 'Accounts', IntegrityError(1062, "Duplicate entry 'Accounts' for key 'PRIMARY'"))

Hi,
Please help.
as on Saturday, June 25, 2022 7:30 AM
OS: Ubuntu 20.04 on VPS
Python: Python 3.8.10
Node.js: v14.19.3
Redis-Server: Redis server v=5.0.7 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=66bd629f924ac924
MariaDB: mysqld Ver 10.3.35-MariaDB-1:10.3.35+maria~focal for debian-linux-gnu on x86_64 (mariadb.org binary distribution)
Yarn: 1.22.19
Pip: pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
wkhtmltopdf: wkhtmltopdf 0.12.5

After Step 17, it’s showing error and not working.

erpnext@vps:~/frappe-bench$ bench restart
$ supervisorctl restart frappe:
frappe: ERROR (no such group)
frappe: ERROR (no such group)
ERROR:
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/dist-packages/bench/cli.py", line 121, in cli
    raise e
  File "/usr/local/lib/python3.8/dist-packages/bench/cli.py", line 111, in cli
    bench_command()
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/bench/commands/utils.py", line 29, in restart
    Bench(".").reload(web, supervisor, systemd)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 151, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py", line 286, in restart_supervisor_processes
    bench.run(f"{sudo}supervisorctl restart {group}")
  File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 47, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/__init__.py", line 153, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

After a reboot of my VPS
re-ran Step 17 and output is:

erpnext@vps:~$ cd frappe-bench
erpnext@vps:~/frappe-bench$ sudo bench setup production erpnext
Setting Up prerequisites...
Setting Up supervisor...
Update your /etc/supervisor/supervisord.conf with the following values:
[unix_http_server]
chmod=0760
chown=erpnext:erpnext
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site erp.respoproducts.com assigned port: 80
Setting Up symlinks and reloading services...
$ /usr/bin/supervisorctl reread
No config updates to processes
$ /usr/bin/supervisorctl update
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx
erpnext@vps:~/frappe-bench$ bench restart
$ supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-workers:frappe-bench-frappe-short-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-long-worker-0: stopped
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: started
frappe-bench-workers:frappe-bench-frappe-default-worker-0: started
frappe-bench-workers:frappe-bench-frappe-short-worker-0: started
frappe-bench-workers:frappe-bench-frappe-long-worker-0: started
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started

No success :tired_face::tired_face: