Issues with bench update and migrate with browser showing Sorry! We will be back soon

I am unable to access ERPnext on the browser as it is showing the following:

Sorry!

We will be back soon.

Don’t panic. It’s not you, it’s us.
Most likely, our engineers are updating the code, and it should take a minute for the new code to load into memory.

Try refreshing after a minute or two.

I am having the following error upon running bench update:

brunze@Portal:~/frappe-bench/sites$ bench update
/home/brunze/frappe-bench/env/bin/python: Error wh ile finding module specification for ‘frappe.utils .bench_helper’ (ModuleNotFoundError: No module nam ed ‘frappe’)

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ’ bench’)()
File “/home/brunze/.bench/bench/cli.py”, line 41 , in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core. py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core. py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core. py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke( sub_ctx))
File “/usr/lib/python3/dist-packages/click/core. py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core. py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/brunze/.bench/bench/commands/update. py”, line 25, in update
update(pull=pull, patch=patch, build=build, re quirements=requirements, restart_supervisor=restar t_supervisor, restart_systemd=restart_systemd, bac kup=not no_backup, force=force, reset=reset)
File “/home/brunze/.bench/bench/utils.py”, line 176, in update
version_upgrade = is_version_upgrade()
File “/home/brunze/.bench/bench/app.py”, line 27 6, in is_version_upgrade
fetch_upstream(app, bench_path=bench_path)
File “/home/brunze/.bench/bench/app.py”, line 32 3, in fetch_upstream
return subprocess.call([“git”, “fetch”, “upstr eam”], cwd=repo_dir)
File “/usr/lib/python3.8/subprocess.py”, line 34 0, in call
with Popen(*popenargs, **kwargs) as p:
File “/usr/lib/python3.8/subprocess.py”, line 85 8, in init
self.execute_child(args, executable, preexec fn, close_fds,
File “/usr/lib/python3.8/subprocess.py”, line 17 04, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or direc tory: ‘./apps/frappe’

Upon running bench migrate, the error is:
brunze@Portal:~/frappe-bench/sites$ bench migrate
/home/brunze/frappe-bench/env/bin/python: Error while finding module specification for ‘frappe.utils.bench_helper’ (ModuleNotFoundError: No module named ‘frappe’)

Usage: bench [OPTIONS] COMMAND [ARGS]…
Try “bench --help” for help.

Error: No such command “migrate”.

Please what can i do to resolve this?

Hi,

Is this the first time an update has been tried?
What does bench version return?

@smino

erpnext 13.23.3
frappe 14.x.x-develop

The situation has changed. I now have internal server error. mysql is active and running.

brunze@Portal:~/frappe-bench$ /etc/init.d/mysql status
● mariadb.service - MariaDB 10.3.34 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-03-27 15:53:46 UTC; 56min ago
Docs: man:mysqld(8)
systemd - MariaDB Knowledge Base
Main PID: 1072 (mysqld)
Status: “Taking your SQL requests now…”
Tasks: 34 (limit: 2339)
Memory: 585.5M
CGroup: /system.slice/mariadb.service
└─1072 /usr/sbin/mysqld

System load is as follows

System load: 0.0
Usage of /: 23.6% of XXXXGB
Memory usage: 53%
Swap usage: 0%

Bench restart command gives the following output

brunze@Portal:~/frappe-bench$ bench restart
[sudo] password for brunze:
$ sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-short-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
brunze@Portal:~/frappe-bench$

Bench Update throws the following error:

brunze@Portal:~/frappe-bench$ bench update
fatal: ‘upstream’ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/brunze/.bench/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/brunze/.bench/bench/commands/update.py”, line 25, in update
update(pull=pull, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, force=force, reset=reset)
File “/home/brunze/.bench/bench/utils.py”, line 176, in update
version_upgrade = is_version_upgrade()
File “/home/brunze/.bench/bench/app.py”, line 283, in is_version_upgrade
raise InvalidBranchException(“Specified branch of app {0} is not in upstream”.format(app))
bench.app.InvalidBranchException: Specified branch of app frappe is not in upstream
brunze@Portal:~/frappe-bench$

Bench migrate gives the following error:

brunze@Portal:~/frappe-bench$ bench migrate
Migrating demo.brunze.ng
Could not find app “chat”

Traceback (most recent call last):
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1127, in load_app_hooks
app_hooks = get_module(app + “.hooks”)
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1015, in get_module
return importlib.import_module(modulename)
File “/home/brunze/frappe-bench/env/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 961, in _find_and_load_unlocked
File “”, line 219, in _call_with_frames_removed
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘chat’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/brunze/frappe-bench/apps/frappe/frappe/migrate.py”, line 170, in run
self.pre_schema_updates()
File “/home/brunze/frappe-bench/apps/frappe/frappe/migrate.py”, line 40, in wrapper
ret = method(*args, **kwargs)
File “/home/brunze/frappe-bench/apps/frappe/frappe/migrate.py”, line 105, in pre_schema_updates
for fn in frappe.get_hooks(“before_migrate”, app_name=app):
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1145, in get_hooks
hooks = _dict(load_app_hooks(app_name))
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1135, in load_app_hooks
sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/home/brunze/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
main()
File “/home/brunze/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/brunze/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/brunze/frappe-bench/apps/frappe/frappe/commands/init.py”, line 26, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/brunze/frappe-bench/apps/frappe/frappe/commands/site.py”, line 457, in migrate
SiteMigration(
File “/home/brunze/frappe-bench/apps/frappe/frappe/migrate.py”, line 173, in run
self.post_schema_updates()
File “/home/brunze/frappe-bench/apps/frappe/frappe/migrate.py”, line 40, in wrapper
ret = method(*args, **kwargs)
File “/home/brunze/frappe-bench/apps/frappe/frappe/migrate.py”, line 130, in post_schema_updates
sync_fixtures()
File “/home/brunze/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 20, in sync_fixtures
if os.path.exists(frappe.get_app_path(app, “fixtures”)):
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1038, in get_app_path
return get_pymodule_path(app_name, *joins)
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1053, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).file or ‘’), *joins)
File “/home/brunze/frappe-bench/apps/frappe/frappe/init.py”, line 1015, in get_module
return importlib.import_module(modulename)
File “/home/brunze/frappe-bench/env/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘chat’
brunze@Portal:~/frappe-bench$

How do i resolve this?

Try: bench switch-to-branch 13 frappe. then retry the update/migrate

@smino

bench switch-to-branch 13 frappe ----- throws an error

brunze@Portal:~/frappe-bench$ bench switch-to-branch 13 frappe
LOG: Fetching upstream for frappe
$ git remote set-branches upstream ‘*’
fatal: No such remote ‘upstream’
$ git fetch --all
Fetching origin
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 19 (delta 7), reused 12 (delta 0), pack-reused 0
Unpacking objects: 100% (19/19), 9.75 KiB | 1.08 MiB/s, done.
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript
07b471bfba…2796423294 mergify/copy/version-13-hotfix/pr-16358 → origin/mergify/copy/version-13-hotfix/pr-16358
fatal: ‘upstream’ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/brunze/.bench/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/brunze/.bench/bench/commands/update.py”, line 43, in switch_to_branch
switch_to_branch(branch=branch, apps=list(apps), upgrade=upgrade)
File “/home/brunze/.bench/bench/app.py”, line 417, in switch_to_branch
switch_branch(branch, apps=apps, bench_path=bench_path, upgrade=upgrade)
File “/home/brunze/.bench/bench/app.py”, line 389, in switch_branch
version_upgrade = is_version_upgrade(app=app, bench_path=bench_path, branch=branch)
File “/home/brunze/.bench/bench/app.py”, line 283, in is_version_upgrade
raise InvalidBranchException(“Specified branch of app {0} is not in upstream”.format(app))
bench.app.InvalidBranchException: Specified branch of app frappe is not in upstream
brunze@Portal:~/frappe-bench$

Try: bench get-app --overwrite --branch 13 frappe

@smino

bench get-app --overwrite --branch 13 frappe throws this error:

brunze@Portal:~/frappe-bench$ bench get-app --overwrite --branch 13 frappe
INFO:bench.app:Getting app frappe
$ git clone frappe --branch 13 --origin upstream
fatal: repository ‘frappe’ does not exist
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/brunze/.bench/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/brunze/.bench/bench/commands/make.py”, line 62, in get_app
get_app(git_url, branch=branch, skip_assets=skip_assets, overwrite=overwrite)
File “/home/brunze/.bench/bench/app.py”, line 142, in get_app
app_name = get_app_name(bench_path, repo_name)
File “/home/brunze/.bench/bench/app.py”, line 149, in get_app_name
with open(app_path, ‘rb’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘./apps/frappe/setup.py’
brunze@Portal:~/frappe-bench$

Try: bench get-app --overwrite --branch version-13 frappe

I may not have the syntax quite right. the bench switch-to-branch version-13 might work as well.

@smino

I just realised i dont have frappe in my apps folder.

brunze@Portal:~/frappe-bench/apps$ ls
chat erpnext frappe_paystack paystack

I have it in here
brunze@Portal:~/frappe-bench$ ls
apps archived_sites config frappe patches.txt sites
archived_envs bench env logs Procfile

An attempt to run …bench switch-to-branch 13 frappe …from within frappe folder gives:

brunze@Portal:~/frappe-bench/frappe$ bench switch-to-branch 13 frappe /home/brunze/frappe-bench/env/bin/python: Error while finding module specification for ‘frappe.utils.bench_helper’ (ModuleNotFoundError: No module named ‘frappe’)

ERROR: frappe does not exist!

@smino

What can i do about this

You can remove the frappe folder in the frappe-bench folder if you like. Have you tried
bench get-app --overwrite --branch version-13 frappe ?

@smino

i ran -----bench get-app --overwrite --branch version-13 frappe----- with the following result

brunze@Portal:~/frappe-bench/apps$ bench get-app --overwrite --branch version-13 frappe
/home/brunze/frappe-bench/env/bin/python: Error while finding module specification for ‘frappe.utils.bench_helper’ (ModuleNotFoundError: No module named ‘frappe’)

INFO:bench.app:Getting app frappe
$ git clone frappe --branch version-13 --origin upstream
fatal: repository ‘frappe’ does not exist
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/brunze/.bench/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/brunze/.bench/bench/commands/make.py”, line 62, in get_app
get_app(git_url, branch=branch, skip_assets=skip_assets, overwrite=overwrite)
File “/home/brunze/.bench/bench/app.py”, line 142, in get_app
app_name = get_app_name(bench_path, repo_name)
File “/home/brunze/.bench/bench/app.py”, line 149, in get_app_name
with open(app_path, ‘rb’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘./apps/frappe/setup.py’

Is this an attempt to update an existing installation or a new installation that has not been completed due to the above?

@smino

Its an existing installation

@Obi_Obiorah,

if this topic has not check then check it.

Thank You!

Thanks a lot. Its resolved.