ImportError: Module import failed for Invoice Discounting

Almost finished manual install on DO Droplet. Trying to install ERPNext on using bench.

Bench version: 5.8.1
ErpNext version: 13.3.0

Are these versions compatible?

Running [ bench --site install-app erpnext ] gives the below error:

Installing erpnext...
Updating DocTypes for erpnext       : [                                        ] 1%An error occurred while installing erpnext: Module import failed for Invoice Discounting (erpnext.accounts.doctype.invoice_discounting.invoice_discounting Error: No module named '')
Traceback (most recent call last):
  File "apps/frappe/frappe/modules/", line 235, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(module_name)
  File "apps/frappe/frappe/", line 1243, in get_module
    return importlib.import_module(modulename)
  File "/usr/lib/python3.8/importlib/", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "apps/erpnext/erpnext/accounts/doctype/invoice_discounting/", line 16, in <module>
    from erpnext.controllers.accounts_controller import AccountsController
  File "apps/erpnext/erpnext/controllers/", line 30, in <module>
    from erpnext.accounts.doctype.pricing_rule.utils import (
  File "apps/erpnext/erpnext/accounts/doctype/pricing_rule/", line 14, in <module>
    from erpnext.setup.doctype.item_group.item_group import get_child_item_groups
  File "apps/erpnext/erpnext/setup/doctype/item_group/", line 11, in <module>
    from import clear_cache
ModuleNotFoundError: No module named ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/", line 417, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "apps/frappe/frappe/", line 279, in install_app
    sync_for(name, force=force, reset_permissions=True)
  File "apps/frappe/frappe/model/", line 96, in sync_for
  File "apps/frappe/frappe/modules/", line 145, in import_file_by_path
  File "apps/frappe/frappe/modules/", line 242, in import_doc
  File "apps/frappe/frappe/model/", line 268, in insert
  File "apps/frappe/frappe/model/", line 1071, in run_post_save_methods
  File "apps/frappe/frappe/model/", line 912, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/", line 1251, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/", line 1233, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/", line 909, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/core/doctype/doctype/", line 399, in on_update
  File "apps/frappe/frappe/core/doctype/doctype/", line 485, in run_module_method
    module = load_doctype_module(, self.module)
  File "apps/frappe/frappe/modules/", line 237, in load_doctype_module
    raise ImportError(
ImportError: Module import failed for Invoice Discounting (erpnext.accounts.doctype.invoice_discounting.invoice_discounting Error: No module named '')

I was using frappe version 14.x.x.x.
Replaced it with frappe version 13 and now it is working fine.

Now figuring out how to get rid of these warnings -
Browserslist: caniuse-lite is outdated.
Error: ENOSPC: System limit for number of file watchers reached


1 Like

Thanks. I ended up rebuilding the droplet because i installed it in ‘editable mode’ by mistake.
Same issue as this one -

This week I tried three methods of installing (easy install script, docker installation and manual)

Easy install is not maintained and gives a lot of errors. Failed to install.

Docker seems good if you are on low budget system. But documentation can be improved for non-linux users. Was able to install it but not use it (difficult to understand Traefik routing. I am sure this can be solved easily)

Manual install using @bkm 's method. By far the best documented step by step installation with explanation i could find on the internet.

Now figuring out how to use ERPNext.