Error when running bench "update --patch" after fresh install

Hello everyone,

So I am having an issue where I can’t run “bench update --patch”. When I run it, it produces the error below:

 erpnext@ERPNext13:/opt/erpnext/frappe-bench$ bench update --patch
    WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

Backing up sites...
Patching sites...
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/opt/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 99, in <module>
    main()
  File "/opt/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/erpnext/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 26, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/opt/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py", line 280, in migrate
    from frappe.migrate import migrate
  File "/opt/erpnext/frappe-bench/apps/frappe/frappe/migrate.py", line 16, in <module>
    from frappe.cache_manager import clear_global_cache
  File "/opt/erpnext/frappe-bench/apps/frappe/frappe/cache_manager.py", line 7, in <module> 
import frappe.defaults
      File "/opt/erpnext/frappe-bench/apps/frappe/frappe/defaults.py", line 7, in <module> from     frappe.cache_manager import clear_defaults_cache, common_default_keys
    ImportError: cannot import name 'clear_defaults_cache' from partially initialized module 'frappe.cache_manager' (most likely due to a circular import) (/opt/erpnext/frappe-bench/apps/frappe/frappe/cache_manager.py)

Also when I go to my site when the bench is running, it is stuck on this page

I tried to do a fresh install, but the issue still persists. Any help would be appreciated.

run the below command to remove the Updating message.

bench --site [sitename] set-config maintenance_mode 1

I tried that. It ran, but my site still displays the Updating message.

bench clear-cache

if not worked then may be your bench broken.

bench update --reset” in the frappe-bench folder

So I ran “bench update --reset” and then ran “bench update --patch” and it didn’t produce any errors in the console, but the site still shows the same message:

image

I tried running “bench --site [sitename] set-config maintenance_mode 1” as you suggested before, but that ran correctly, but didn’t work.

So I found the solution. I just used the code “bench set-config maintenance_mode 0” instead of setting maintenance mode to 1.

Sorry, its my bad that I forgot to change 1 to 0.:frowning: