Error in update to latest 8.0.29

I am currently on 8.0.16 for erpnext and 8.0.32 for frappe in my dev and prod environments. I am getting this error when updating to latest 8.0.29/8.0.47

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, 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/erpnext/erpnext-dev/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/commands/site.py", line 214                                                                             , in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py",                                                                              line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py",                                                                              line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py",                                                                              line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/patches/v8_0/update_records                                                                             _in_global_search.py", line 11, in execute
    rebuild_for_doctype(doctype)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/global_search.py", line 107, in rebuild_for_doctype
    if hasattr(get_controller(doctype), "is_website_published") and meta.allow_guest_to_view:
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 35, in get_controller
    module = load_doctype_module(doctype, module_name)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/utils.py", line 184                                                                             , in load_doctype_module
    raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name)
ImportError: Module import failed for Student Batch (erpnext.schools.doctype.student_batch.student_batch)

One main reason why I wanted to upgrade what the note in 8.0.25 “Merge the student group and student batch”. I always wondered why there were two things very similar.

Thoughts on error? If this is a bug I can open a git issue on it.

That’s a known issue Upgrade error: Table 'ship.tabStudent Batch Student' doesn't exist · Issue #8875 · frappe/erpnext · GitHub

I have no idea how to check on fix priority for eg a number or queue!?

Hm, mine is different. I have the table, I am getting an import error of some kind

ImportError: Module import failed for Student Batch (erpnext.schools.doctype.student_batch.student_batch)

My guess is the merge of batch into group takes existing batches and exports them into updated group. I have two student groups and a whole ton of student batches. I abandoned groups as nothing was really using them (e.g. the attendance tool was all based on batch).

I am going to open another git issue.
https://github.com/frappe/erpnext/issues/8921

Thanks for the scoop James.

Of course I am a noob reaching and learning the ropes here :slight_smile:

Yep. Thanks for the original view of the other issue. Helped me to figure out that I had a new one. Reading a python traceback is not really easy as well.

Released a fix, please try updating again.

I was able to update this morning to

Let me run through my checks and report back here, but so far so good.

I have the same problem. Updated to latest version and still the same error.
On bench version
frappe 8.0.59
Erpnext 8.0.38
status 503 on browser

any update?

Are you still getting the issue? Please post the traceback.

I will try tonight again. I already restore snapshoot on vm.

i am trying to update again. Still same error. “module import failed for student group instructor”

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.1
npm WARN frappe@ No description
Backing up sites…
Patching sites…
Migrating tok
Executing frappe.patches.v8_0.update_records_in_global_search #11-05-2017 in tok (79bead8e6d65862a)
Updating Global Search : [========================================]Success
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘role’) #2017-05-23 in tok (79bead8e6d65862a)
Success
Executing frappe.patches.v8_0.drop_unwanted_indexes in tok (79bead8e6d65862a)
Success
Executing frappe.patches.v8_0.install_new_build_system_requirements in tok (79bead8e6d65862a)
Please update your NodeJS version
frappe@ /home/tok/frappe-bench
├── babel-core@6.24.1
├── babel-preset-babili@0.0.12
├── babel-preset-es2015@6.24.1
├── babel-preset-es2016@6.24.1
├── babel-preset-es2017@6.24.1
├── chokidar@1.7.0
└── less@2.7.2

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.1
npm WARN frappe@ No description
Success
Executing frappe.patches.v8_0.set_currency_field_precision # 2017-05-09 in tok (79bead8e6d65862a)
Success
Executing frappe.patches.v8_0.rename_print_to_printing in tok (79bead8e6d65862a)
Success
Executing frappe.patches.v8_0.update_desktop_icons in tok (79bead8e6d65862a)
Success
Executing erpnext.patches.v8_0.enable_booking_asset_depreciation_automatically in tok (79bead8e6d65862a)
Success
Executing erpnext.patches.v8_0.set_project_copied_from in tok (79bead8e6d65862a)
Success
Executing erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim in tok (79bead8e6d65862a)
Success
Executing erpnext.patches.v8_0.revert_manufacturers_table_from_item in tok (79bead8e6d65862a)
Success
Executing erpnext.patches.v8_0.disable_instructor_role in tok (79bead8e6d65862a)
Success
Executing erpnext.patches.v8_0.merge_student_batch_and_student_group in tok (79bead8e6d65862a)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, 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/tok/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/tok/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/tok/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/tok/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/tok/frappe-bench/apps/frappe/frappe/commands/site.py”, line 214, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/tok/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/tok/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/tok/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/tok/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/tok/frappe-bench/apps/erpnext/erpnext/patches/v8_0/merge_student_batch_and_student_group.py”, line 46, in execute
doc.save()
File “/home/tok/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in save
return self._save(*args, **kwargs)
File “/home/tok/frappe-bench/apps/frappe/frappe/model/document.py”, line 253, in _save
self.insert()
File “/home/tok/frappe-bench/apps/frappe/frappe/model/document.py”, line 182, in insert
self._set_defaults()
File “/home/tok/frappe-bench/apps/frappe/frappe/model/document.py”, line 498, in _set_defaults
new_doc = frappe.new_doc(df.options, as_dict=True)
File “/home/tok/frappe-bench/apps/frappe/frappe/init.py”, line 582, in new_doc
return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
File “/home/tok/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 19, in get_new_doc
frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
File “/home/tok/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 37, in make_new_doc
“docstatus”: 0
File “/home/tok/frappe-bench/apps/frappe/frappe/init.py”, line 606, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “/home/tok/frappe-bench/apps/frappe/frappe/model/document.py”, line 49, in get_doc
controller = get_controller(doctype)
File “/home/tok/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 35, in get_controller
module = load_doctype_module(doctype, module_name)
File “/home/tok/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 184, in load_doctype_module
raise ImportError, ‘Module import failed for {0} ({1})’.format(doctype, module_name)
ImportError: Module import failed for Student Group Instructor (frappe.core.doctype.student_group_instructor.student_group_instructor)

Now you are getting a separate error. Because somehow in your account, “Module” is set as “Core” for doctype “Student Group Instructor”, which should be “Schools”.

Change the module to “Schools” from mysql and the try to update again.

Could you please explain me further. What is the table name in mysql where i should change this?

@vladucoju enter the database and run a query like:

UPDATE tabDocType SET module = 'Schools' WHERE name = 'Student Group Instructor'

Student group Instructor not exist in a table doctype

I have it …probably some patch didn’t run correctly, try to run: bench migrate

I already try that. Same error again.

Pushed a potential fix to develop branch.
https://github.com/frappe/erpnext/pull/9035