Bench Update Error on Migrate Site: ModuleNotFoundError: No module named 'extra_features'

Hi ERPNEXT Community,

I had been running ERPNEXT V12.5 for a few months and today I decided to update the system to the latest branch. But I ran into an error when migrating site:

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/erpnext/bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/erpnext/bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/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/erpnext/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/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/bench/apps/frappe/frappe/commands/site.py", line 239, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
  File "/home/erpnext/bench/apps/frappe/frappe/migrate.py", line 48, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 41, in run_all
    run_patch(patch)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 30, in run_patch
    if not run_single(patchmodule = patch):
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 77, in execute_patch
    block_user(True)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 127, in block_user
    frappe.db.set_global('__session_status', block and 'stop' or None)
  File "/home/erpnext/bench/apps/frappe/frappe/database/database.py", line 698, in set_global
    self.set_default(key, val, user)
  File "/home/erpnext/bench/apps/frappe/frappe/database/database.py", line 712, in set_default
    frappe.defaults.set_default(key, val, parent, parenttype)
  File "/home/erpnext/bench/apps/frappe/frappe/defaults.py", line 134, in set_default
    add_default(key, value, parent)
  File "/home/erpnext/bench/apps/frappe/frappe/defaults.py", line 147, in add_default
    d.insert(ignore_permissions=True)
  File "/home/erpnext/bench/apps/frappe/frappe/model/document.py", line 223, in insert
    self.run_method("before_insert")
  File "/home/erpnext/bench/apps/frappe/frappe/model/document.py", line 794, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/erpnext/bench/apps/frappe/frappe/model/document.py", line 1061, in composer
    hooks.append(frappe.get_attr(handler))
  File "/home/erpnext/bench/apps/frappe/frappe/__init__.py", line 1046, in get_attr
    return getattr(get_module(modulename), methodname)
  File "/home/erpnext/bench/apps/frappe/frappe/__init__.py", line 827, in get_module
    return importlib.import_module(modulename)
  File "/home/erpnext/bench/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/erpnext/bench/apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/sms_notification/sms_notification.py", line 14, in <module>
    from extra_features.tools import print_out
ModuleNotFoundError: No module named 'extra_features'

Anyone has any idea how to fix this?

What command(s) produced the error message? Have you tried bench updare --reset ?

I’ve tried bench update --reset a few times, still doesn’t work. Everytime it gets to migrating site, I get the same error.

@Ratanak Do you have any custom apps installed? This could be the due to a broken Python environment. Try bench --site {site-name} list-apps to check the installed apps on your site.

I have the ERPNEXT telegram integration app installed. It was working fine with V 12.5.0.

I’ve found out the cause of the error, it was caused by the custom app Erpnext Telegram Integration. I reverted the app back to its previous version, and everything works fine.

1 Like

@Ratanak

Thank you for sharing the solution.
Please Mark as solved & close this subject.

Commands that could help:

  • bench setup requirements --python
  • bench pip install -e apps/erpnext_telegram_integration
2 Likes

bench setup requirements --python
Usage: bench frappe [OPTIONS] COMMAND [ARGS]…
Try ‘bench frappe --help’ for help.

Error: No such command ‘setup’.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 20, in
subprocess.check_call(
File “/usr/local/lib/python3.9/subprocess.py”, line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[’/home/frappe/frappe-bench/env/bin/python’, ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’, ‘frappe’, ‘setup’, ‘requirements’, ‘–python’]’ returned non-zero exit status 2.

I got this error in my production setup.