Help: Error while updating V6 to V7

Hi Guys,

I have a ERPNext V6 with several sites (under 10). Previously I have amended the html files to edit the label of ‘erpnext’ to my company’s. No codings were amended. I have already performed ‘git stash’ for folders in frappe-bench/apps to restore back to original files.

I am trying to upgrade from v6 to v7 but keep getting this error; this is the first site in alphabetical order.

This is the latest error message. Hope someone can help! Much appreciated!


Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/frappe/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py”, line 5, in execute
frappe.rename_doc(‘DocType’, ‘Scheduler Log’, ‘Error Log’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 650, in rename_doc
return rename_doc(doctype, old, new, force=force, merge=merge, ignore_permissions=ignore_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/rename_doc.py”, line 62, in rename_doc
rename_password(doctype, old, new)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/password.py”, line 71, in rename_password
{ ‘doctype’: doctype, ‘new_name’: new_name, ‘old_name’: old_name })
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 137, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1054, “Unknown column ‘doctype’ in ‘where clause’”)

1 Like

I have tried reading up all the past posts on similar V6 to V7 upgrade but couldn’t find anyone with the same error message as me :frowning:

This is the latest error message i’m getting; hope it helps to clarify


[frappe@centos-1gb-sgp1-01 ~]$ bench update --upgrade
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe

  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext
    From https://github.com/frappe/erpnext
  • branch master -> FETCH_HEAD
    Already up-to-date.
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    Migrating chemdex.inspireerp.com
    Executing finally:frappe.patches.v6_24.sync_desktop_icons in chemdex.inspireerp.com (chemdex)
    Success
    Executing erpnext.patches.v6_20x.remove_customer_supplier_roles in chemdex.inspireerp.com (chemdex)
    Traceback (most recent call last):
    File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
    frappe.modules.patch_handler.run_all()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
    if not run_single(patchmodule = patch):
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + “.execute”)()
    File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v6_20x/remove_customer_supplier_roles.py”, line 20, in execute
    d.save()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 233, in save
    return self._save(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 262, in save
    self.run_before_save_methods()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 753, in run_before_save_methods
    self.run_method(“validate”)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 654, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 882, in composer
    return composed(self, method, *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 865, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 648, in
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 52, in validate
    validate_fields(self)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 462, in validate_fields
    check_link_table_options(d)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 306, in check_link_table_options
    frappe.throw(
    (“Options must be a valid DocType for field {0} in row {1}”).format(d.label, d.idx))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 300, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 293, in msgprint
    _raise_exception()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 266, in _raise_exception
    raise raise_exception, encode(msg)
    frappe.exceptions.ValidationError: Options must be a valid DocType for field Source in row 82

So this would happen when a link field doesn’t have the right doctype connected to it. Not sure why it’s breaking here.

I restore to an older backup and did the update process again.

This is what i did:


------------------------------ Login as root ------------------------------
Step 1: Uninstall all version of Node js first
sudo yum remove nodejs
sudo yum remove npm
sudo yum update

Step 2: Install Nodejs 6.x version
curl -sL https://rpm.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo yum install -y nodejs
sudo yum groupinstall “Development Tools”

Step 3: Install Python setup tools
sudo pip install --upgrade setuptools
sudo yum install gcc libffi-devel python-devel openssl-devel

Step 4: Install cryptography, make sure no red messages during installation
sudo pip install cryptography

Step5 : Reboot, essential as cryptography only works after reboot
reboot

------------------------------ Login as frappe --------------------------
!!! Extra Step: [Important] Error in Bench Update?
cd bench-repo
git pull origin

Step 6: Login through frappe user, you should have your system upgraded from V6 to V7, will take few minutes
cd frappe-bench
bench update --upgrade

I encountered the below Traceback :frowning:


Successfully installed pip-8.1.2
Migrating chemdex.inspireerp.com
Executing frappe.patches.v7_1.rename_scheduler_log_to_error_log in chemdex.inspireerp.com (chemdex)
Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/frappe/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py”, line 5, in execute
frappe.rename_doc(‘DocType’, ‘Scheduler Log’, ‘Error Log’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 650, in rename_doc
return rename_doc(doctype, old, new, force=force, merge=merge, ignore_permissions=ignore_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/rename_doc.py”, line 62, in rename_doc
rename_password(doctype, old, new)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/password.py”, line 71, in rename_password
{ ‘doctype’: doctype, ‘new_name’: new_name, ‘old_name’: old_name })
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 137, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1054, “Unknown column ‘doctype’ in ‘where clause’”)

1 Like

I am getting the same error as David’s. The funny thing is that when I re-run bench update --upgrade, the error message disappear, replaced by new one. After trying 3 times, the upgrade process stuck on “Options must be a valid DocType”.

Any kind souls care to advice?

do you have a script that sql “where doctype” ?

because this line mysqlexceptions.OperationalError: (1054, "Unknown column 'doctype' in 'where clause'") means that in your where clause it doesn’t have field “doctype” in it’s table

Actually we didn’t amend any codings or database structure, so i have no idea why it is showing such an error message.

Hi,

Any developer who is willing to take on a freelance job and at the same time help a fellow community member please feel free to contact me :slight_smile:

https://community.erpnext.com/jobs/upgrade-service-from-v6-to-v7

I’ll email you :slight_smile:

Hi, I guess bench migrate missed the patch v7.0/update_auth.py. Please try bench --migrate and see if this patch is running.

Fixed the issue in the latest release, can you please update again?

@nabinhait
Its solved but lead to other errors.

We try bench update --upgrade we got following error
_mysql_exceptions.OperationalError: (1054, "Unknown column 'doctype' in 'where clause'")
See full trace at http://pastebin.com/U8fUm1Mi

And we again execute bench update --upgrade and above error went away but new following appeared which is persistent.
ImportError: No module named desktop_icon.desktop_icon
See full trace at http://pastebin.com/1X9A8RRg

Thanks,
Nick

1 Like

@Nick I am having the same issue when updating to ERPNext 7
Module import failed for Desktop Icon

When I run
bench update --upgrade
I get this:
http://pastebin.com/vjLAW9uw

Executing erpnext.patches.v7_0.fix_duplicate_icons in site1.local (1bd3e0294d)
Module import failed for Desktop Icon (frappe.core.doctype.desktop_icon.desktop_icon)
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/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/frappe/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/frappe/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/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/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/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v7_0/fix_duplicate_icons.py”, line 11, in execute
sync_desktop_icons()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/doctype/desktop_icon/desktop_icon.py”, line 296, in sync_desktop_icons
sync_from_app(app)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/doctype/desktop_icon/desktop_icon.py”, line 325, in sync_from_app
‘owner’: ‘Administrator’
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 589, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 45, in get_doc
controller = get_controller(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 34, in get_controller
module = load_doctype_module(doctype, module_name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 171, in load_doctype_module
doctype_python_modules[key] = frappe.get_module(module_name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 654, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named desktop_icon.desktop_icon

Pushed a fix, it will be released by the end of today

2 Likes

Thanks @nabinhait!

I was able to successfully update! :grinning:

thanks so much!