Module import failed for Sales Invoice

wribhu@wribhu-VirtualBox:~/frappe-bench$ bench new-site orian2 --install-app erpnext
MySQL root password: 
Installing frappe...
Updating frappe                     : [========================================]
Updating country info               : [========================================]
Set Administrator password: 
Re-enter Administrator password: 
Installing erpnext...
Updating erpnext                    : [                                        ]Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/wribhu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/wribhu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/wribhu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/wribhu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/wribhu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/wribhu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/commands/site.py", line 26, in new_site
    verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/commands/site.py", line 60, in _new_site
    _install_app(app, verbose=verbose, set_as_patched=not source_sql)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/installer.py", line 132, in install_app
    sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/sync.py", line 45, in sync_for
    reset_permissions=reset_permissions)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 129, in import_doc
    doc.insert()
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/document.py", line 212, in insert
    self.run_post_save_methods()
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/document.py", line 776, in run_post_save_methods
    self.run_method("on_update")
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/document.py", line 655, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/document.py", line 871, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/document.py", line 854, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/model/document.py", line 649, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 197, in on_update
    self.run_module_method("on_doctype_update")
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 206, in run_module_method
    module = load_doctype_module(self.name, self.module)
  File "/home/wribhu/frappe-bench/apps/frappe/frappe/modules/utils.py", line 179, in load_doctype_module
    raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name)
ImportError: Module import failed for Sales Invoice (erpnext.accounts.doctype.sales_invoice.sales_invoice)

Hi @wribhu,

Do you have any local changes? When did you take the last bench update?

I’m running bench version 4.0.0

wribhu@wribhu-VirtualBox:~/frappe-bench$ bench --version
4.0.0
wribhu@wribhu-VirtualBox:~/frappe-bench$` 

But when i tried to update bench i got this error

wribhu@wribhu-VirtualBox:~/frappe-bench$ bench update

This update will remove Celery config and prepare the bench to use Python RQ.
And it will overwrite Procfile and supervisor.conf.
If you don't know what this means, type Y ;)

Do you want to continue? [y/N]: Y

This update will replace ERPNext's Redis configuration files to fix a major security issue.
If you don't know what this means, type Y ;)

Do you want to continue? [y/N]: Y
INFO:bench.utils:updating bench
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/wribhu/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/wribhu/bench-repo/bench/commands/update.py", line 34, in update
    update_bench()
  File "/home/wribhu/bench-repo/bench/utils.py", line 188, in update_bench
    exec_cmd("git pull", cwd=cwd)
  File "/home/wribhu/bench-repo/bench/utils.py", line 88, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull

Actually, I’m trying to install ERPNext 4.12.0 and shopping cart 4.12.0.
Also, The ERPNext app has some local customization.