ImportError: Module import failed for Invoice Discounting

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

Bench version: 5.8.1
ErpNext version: 13.3.0

Are these versions compatible?

Running [ bench --site erp.mywebsite.com 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 'frappe.website.render')
Traceback (most recent call last):
  File "apps/frappe/frappe/modules/utils.py", line 235, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(module_name)
  File "apps/frappe/frappe/__init__.py", line 1243, in get_module
    return importlib.import_module(modulename)
  File "/usr/lib/python3.8/importlib/__init__.py", 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/invoice_discounting.py", line 16, in <module>
    from erpnext.controllers.accounts_controller import AccountsController
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 30, in <module>
    from erpnext.accounts.doctype.pricing_rule.utils import (
  File "apps/erpnext/erpnext/accounts/doctype/pricing_rule/utils.py", 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/item_group.py", line 11, in <module>
    from frappe.website.render import clear_cache
ModuleNotFoundError: No module named 'frappe.website.render'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 417, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "apps/frappe/frappe/installer.py", line 279, in install_app
    sync_for(name, force=force, reset_permissions=True)
  File "apps/frappe/frappe/model/sync.py", line 96, in sync_for
    import_file_by_path(
  File "apps/frappe/frappe/modules/import_file.py", line 145, in import_file_by_path
    import_doc(
  File "apps/frappe/frappe/modules/import_file.py", line 242, in import_doc
    doc.insert()
  File "apps/frappe/frappe/model/document.py", line 268, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1071, in run_post_save_methods
    self.run_method("on_update")
  File "apps/frappe/frappe/model/document.py", line 912, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1251, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1233, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 909, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 399, in on_update
    self.run_module_method("on_doctype_update")
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 485, in run_module_method
    module = load_doctype_module(self.name, self.module)
  File "apps/frappe/frappe/modules/utils.py", 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 'frappe.website.render')

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

This?

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.

2 Likes