frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.85k stars 7.33k forks source link

Upgrade error: V4 to V5 #3680

Closed betoled closed 9 years ago

betoled commented 9 years ago

When upgrading from V4 to V5 I get an error. I run these bench update --upgrade but when it reaches the rename_table_fieldnames command I get following error :

Successfully installed unidecode erpnext Cleaning up... Database backed up /home/erpnext/frappe-bench/sites/erpnext.erpnext-vm/private/backups/20150717_81758089_database.sql.gz Migrating erpnext.erpnext-vm Executing frappe.patches.v5_0.convert_to_barracuda_and_utf8mb4 in erpnext.erpnext-vm (erpnext) Success Executing execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2015-05-15 in erpnext.erpnext-vm (erpnext) Success Executing execute:frappe.reload_doc('email', 'doctype', 'email_alert') #2014-07-15 in erpnext.erpnext-vm (erpnext) Success Executing execute:frappe.reload_doc('desk', 'doctype', 'todo') #2014-12-31-1 in erpnext.erpnext-vm (erpnext) Success Executing execute:frappe.reload_doc('custom', 'doctype', 'property_setter') #2014-12-31-1 in erpnext.erpnext-vm (erpnext) Success Executing frappe.patches.v5_0.v4_to_v5 in erpnext.erpnext-vm (erpnext) Success Executing frappe.patches.v5_0.remove_shopping_cart_app in erpnext.erpnext-vm (erpnext) Success Executing execute:frappe.permissions.reset_perms("Module Def") in erpnext.erpnext-vm (erpnext) Success Executing execute:frappe.permissions.reset_perms("User") #2015-03-24 in erpnext.erpnext-vm (erpnext) Success Executing frappe.patches.v5_0.rename_table_fieldnames in erpnext.erpnext-vm (erpnext) 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/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 77, in main() File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 14, in main click.Group(commands=commands)(prog_name='bench') File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in call return self.main(_args, _kwargs) File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main rv = self.invoke(ctx) File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke return ctx.invoke(self.callback, _ctx.params) File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke return callback(_args, _kwargs) File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands.py", line 28, in _func ret = f(frappe._dict(ctx.obj), args, _kwargs) File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands.py", line 205, in migrate frappe.modules.patch_handler.run_all() File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all if not run_single(patchmodule = patch): File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single return execute_patch(patchmodule, method, methodargs) File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch frappe.get_attr(patchmodule.split()[0] + ".execute")() File "/home/erpnext/frappe-bench/apps/frappe/frappe/patches/v5_0/rename_table_fieldnames.py", line 32, in execute rename_field(dt, field[0], field[1]) TypeError: 'module' object is not callable Traceback (most recent call last): File "/usr/local/bin/bench", line 9, in load_entry_point('bench==0.1', 'console_scripts', 'bench')() File "/home/erpnext/bench-repo/bench/cli.py", line 55, in cli bench() File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 610, in call return self.main(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 590, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 936, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 782, in invoke return ctx.invoke(self.callback, *_ctx.params) File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 416, in invoke return callback(_args, **kwargs) File "/home/erpnext/bench-repo/bench/cli.py", line 247, in update patch_sites() File "/home/erpnext/bench-repo/bench/utils.py", line 118, in patch_sites run_frappe_cmd('--site', 'all', 'migrate', bench=bench) File "/home/erpnext/bench-repo/bench/utils.py", line 427, in run_frappe_cmd subprocess.check_call((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir) File "/usr/lib/python2.7/subprocess.py", line 511, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '('/home/erpnext/frappe-bench/env/bin/python', '-m', 'frappe.utils.bench_helper', 'frappe', '--site', 'all', 'migrate')' returned non-zero exit status 1

Does anyone know how to fix this ?

Thanks, Benjamien

nabinhait commented 9 years ago

Fixed in develop branch. It will be merged in master on Monday.

https://github.com/frappe/erpnext/commit/0a3be6da272610fba8ae500b09963948ef0ebcc8

You can make the changes manually to proceed.

nabinhait commented 9 years ago

Also apply changes below:

https://github.com/frappe/erpnext/commit/1401e3f679de58c8313feb144ea8571d7c86809c https://github.com/frappe/erpnext/commit/dae29bf2d4c403414376e6e4228ae80d8340998e

betoled commented 9 years ago

I switched to develop and tried the bench update again. But I still get the same error. My local files have the changes, I checked.

From https://github.com/frappe/frappe

nabinhait commented 9 years ago

Sorry, it was not fixed properly, please try again.

betoled commented 9 years ago

I tried bench-update again, but the error remains the same.

nabinhait commented 9 years ago

Please check if it works now

betoled commented 9 years ago

No, still the same error.

nabinhait commented 9 years ago

please share the traceback

betoled commented 9 years ago

This is what I get :

From https://github.com/frappe/frappe
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
From https://github.com/frappe/erpnext
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
Migrating erpnext.erpnext-vm
Executing frappe.patches.v5_0.rename_table_fieldnames in erpnext.erpnext-vm (erpnext)
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/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 77, in <module>
    main()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 14, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands.py", line 28, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands.py", line 205, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/patches/v5_0/rename_table_fieldnames.py", line 32, in execute
    rename_field(dt, field[0], field[1])
TypeError: 'module' object is not callable
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/erpnext/bench-repo/bench/cli.py", line 55, in cli
    bench()
  File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click-3.3-py2.7.egg/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/bench-repo/bench/cli.py", line 263, in retry_upgrade
    patch_sites()
  File "/home/erpnext/bench-repo/bench/utils.py", line 118, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench=bench)
  File "/home/erpnext/bench-repo/bench/utils.py", line 427, in run_frappe_cmd
    subprocess.check_call((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir)
  File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('/home/erpnext/frappe-bench/env/bin/python', '-m', 'frappe.utils.bench_helper', 'frappe', '--site', 'all', 'migrate')' returned non-zero exit status 1
rmehta commented 9 years ago

@betoled please format your trace when you post. Will save us a lot of effort.

betoled commented 9 years ago

I've just tried again, and I get a new error now

remote: Counting objects: 10, done. remote: Compressing objects: 100% (10/10), done. remote: Total 10 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (10/10), done. From https://github.com/frappe/frappe a645016..c6f605b develop -> upstream/develop From https://github.com/frappe/frappe

betoled commented 9 years ago

I got past this by removing the 'Custom' record from the table. I tried bench update again and got a new error

From https://github.com/frappe/frappe

nabinhait commented 9 years ago

Pushed fix.

betoled commented 9 years ago

New error

From https://github.com/frappe/frappe

nabinhait commented 9 years ago

Somehow "Journal Voucher" has not renamed to "Journal Entry" before running this patch.

Try bench --site <your_site_name> execute erpnext.patches.v5_0.rename_table_fieldnames.execute first and then retry upgrade.

betoled commented 9 years ago

I tried the patch again but that did not work. I manually changed the names in the database and ran the upgrade again. Now it worked !

It seems like the complete upgrade worked, and we now have version 5.

Thank you very much for your support !!!

rmehta commented 9 years ago

@betoled please do consider donating :)