Error Upgrade from Version 7 to latest version

I am trying to upgrade ERPNext to latest version but encounter below error. Now I cant access my ERPNext and I can’t restore it as well.

frappe@erpnext:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream master
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream master
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    Updating node packages…
    INFO:bench.utils:npm install
    npm WARN frappe@ No description
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

up to date in 4.225s
Backing up sites…
Patching sites…
Migrating site1.local
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 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, 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 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/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/frappe/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/frappe/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/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, 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 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, 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 69, in execute_patch
block_user(True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 118, in block_user
frappe.db.set_global(‘__session_status’, block and ‘stop’ or None)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 719, in set_global
self.set_default(key, val, user)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 727, in set_default
frappe.defaults.set_default(key, val, parent, parenttype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py”, line 109, in set_default
add_default(key, value, parent)
File “/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py”, line 120, in add_default
d.insert(ignore_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 245, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 905, in run_post_save_methods
if self.meta.track_changes and self._doc_before_save and not self.flags.ignore_version:
AttributeError: ‘Meta’ object has no attribute ‘track_changes’
frappe@erpnext:~/frappe-bench$

@fachmi Try to upgrade version wise like 7 to 8, then 8 to 9 and so on. Don’t upgrade directly from 7 to 10.

Do you have the step to upgrade just to version 8?

Finally I managed to fresh install V7 and then restore the database into it.
I tried fresh install V10 but I can’t restore the database to V10.

After restoring it on V7, try running a bench update .
Post the error log here if you face any after that.

I got no more error and can successfully run bench update --upgrade,
But my version still V7.

I am trying to upgrade from v7.2.31 to latest version but no luck.
tried to upgrade to v8.x.x first with guidelines from here Unable to install ERPnext v8 due to pip v19 but also no luck. it still stuck with v7.2.31

result from git remote -v shows below;
upstream GitHub - bailabs/frappe-v7 (fetch)
upstream GitHub - bailabs/frappe-v7 (push)

I dont know if the problem because of this matter.

If anyone could give some guidance to upgrade, that would be appreciate it.

I agree, you need to point to the standard upstream repos, like this case:

(env) frappe@erpnext:~/frappe-bench$ cd apps/frappe/
(env) frappe@erpnext:~/frappe-bench/apps/frappe$ git remote -v
upstream GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript (fetch)
upstream GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript (push)
(env) frappe@erpnext:~/frappe-bench/apps/frappe$ cd …/erpnext
(env) frappe@erpnext:~/frappe-bench/apps/erpnext$ git remote -v
upstream GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) (fetch)
upstream GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) (push)

Something like this should fix that -

For the frappe repos

frappe@ubuntu:~/frappe-bench/apps/frappe$ git remote remove upstream
frappe@ubuntu:~/frappe-bench/apps/frappe$ git remote add upstream GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

And for the erpnext repos

frappe@ubuntu:~/frappe-bench/apps/erpnext$ git remote remove upstream
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git remote add upstream GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)

Be sure to try this in a test environment and/or have backup before you run your update…

once, I point to the right repos, how can I upgrade step by step from v7 to v8 then v8 to v9, and so on?

To update version by version, you would need to specify to git the particular version tag to checkout from the repository. Posts like this give the basic idea How to install a specific version of ERPNext