Error when restoring from backup

i have now tried everything i did a fresh install of erp next the restored the backup and when i tried to do bench migrate or bench update i get errors

these are the errors

Updating customizations for Address

Traceback (most recent call last):
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 171, in run
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 40, in wrapper
ret = method(*args, **kwargs)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 112, in run_schema_updates
frappe.modules.patch_handler.run_all(skip_failing=self.skip_failing, patch_type=PatchType.pre_model_sync)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/modules/”, line 76, in run_all
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/modules/”, line 63, in run_patch
if not run_single(patchmodule = patch):
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/modules/”, line 145, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/modules/”, line 160, in execute_patch
_patch = frappe.get_attr(patch)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 1239, in get_attr
return getattr(get_module(modulename), methodname)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 1015, in get_module
return importlib.import_module(modulename)
File “/usr/lib64/python3.8/importlib/”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 843, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/home/admin/books/erpnext/shamz-bench/apps/erpnext/erpnext/patches/v13_0/”, line 5, in
from erpnext.setup.install import create_print_uom_after_qty_custom_field
ImportError: cannot import name ‘create_print_uom_after_qty_custom_field’ from ‘erpnext.setup.install’ (/home/admin/books/erpnext/shamz-bench/apps/erpnext/erpnext/setup/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib64/python3.8/”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib64/python3.8/”, line 87, in _run_code
exec(code, run_globals)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/utils/”, line 104, in
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/utils/”, line 18, in main
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 829, in call
return self.main(*args, **kwargs)
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 782, in main
rv = self.invoke(ctx)
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/admin/books/erpnext/shamz-bench/env/lib/python3.8/site-packages/click/”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/commands/”, line 26, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/commands/”, line 457, in migrate
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 173, in run
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 40, in wrapper
ret = method(*args, **kwargs)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 132, in post_schema_updates
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/modules/”, line 95, in sync_customizations
sync_customizations_for_doctype(data, folder)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/modules/”, line 150, in sync_customizations_for_doctype
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/core/doctype/doctype/”, line 836, in validate_fields_for_doctype
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/core/doctype/doctype/”, line 1153, in validate_fields
check_unique_fieldname(meta.get(“name”), d.fieldname)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/core/doctype/doctype/”, line 870, in check_unique_fieldname
(“{0}: Fieldname {1} appears multiple times in rows {2}”).format(docname, fieldname, ", ".join(duplicates)), UniqueFieldnameError)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 449, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 428, in msgprint
File “/home/admin/books/erpnext/shamz-bench/apps/frappe/frappe/”, line 383, in _raise_exception
raise raise_exception(msg)
frappe.core.doctype.doctype.doctype.UniqueFieldnameError: Address: Fieldname is_your_company_address appears multiple times in rows 20, 21

both the backup and the fresh install are n v13 so i have no idea why im getting this error
any help please

try doing the fresh install and then do the bench update.

Once the above is completed… do the backup restore

I am also facing this issue, when i run “bench update” show the following Error.

[Bench Update Error ipython = 7.31.1

After that bench cannot Start.
How to fix this issue.?

I did that
I did with fresh I stall
I did with developer mode
Without developer mode
But nada
It’s just giving me errors upon errors

Which version of ERPnext did you backup from ?

And which one are you fresh installing ???

Both are 13 the build might me different but both 13

This supposed to be seamless without any Hassels but I’m struggling for almost 2 weeks now…

Yes it is seamless

But what is the build you have backed up from and which build are you freshly installing

You see the error you are getting is because of a patch for a build v13-beta-pre-release-5 way in 2020 (chore: change log for v13-beta-pre-release-5 by rohitwaghchaure · Pull Request #23846 · frappe/erpnext · GitHub)… now if you are upgrading you shouldn’t have problem in most cases as the backup would be the old build and the fresh install would be the latest …

but if you are downgrading… its a problem

the old where the data is

Installed Apps

ERPNext: v13.x.x-develop () (develop)

Frappe Framework: v13.x.x-develop () (develop)

the new before restore

erpnext 13.x.x-develop
frappe 14.x.x-develop

evrytime i do a new install i see it brings frappe to version 14

Why are you running bench migrate after a backup , is there any reason for that ??

A bench update is more than enough

I tried bench update first
Then read on some forums to do a bench migrate
So I re installed frappe and erp next last night
Before I get to restore the database let me run it pass you
BTW Thankz for the help

Since it’s a new installation I am gonner run through the process of first set up
Is that correct or should I just go and restore the database… First and then do bench update
Or should I go ahead and do a complete setup then restore the database and then bench update

I too am running the develop branch

For new installation if you are using the develop branch… it will always be the bleeding edge. So a bench update or bench migrate is not needed immediately after a new installation for some time.

Once the new installation is completed. I won’t do the initial company setup but will only restore the backup.

Then I usually check both the Frappe and Erpnext Github develop branch on a daily basis to see if any new feature or issue that might be important are resolved and probably would wait a weeks time before I do a bench update.

And maybe once in a while do a bench update --reset (bench migrate is part of both the commands).

OK so is it better to switch bench to master instead of development
If so how can I do that now
I will do a restore immediately
Should I then do a bench update

Running a develop branch is never intended for production usage as you know being in the bleeding edge always come with some issue.

If you want a stable branch , then go for V 13 with the latest build.

But the issue is you have backed up using the develop branch… so there are tables or columns of certain tables that won’t be available or backported to v 13. In this case you are prone to run into issue.

The best in this scenario would be … do a new installation with develop branch and once completed don’t login. Do a backup restore . then login into you system with you old username and password.

once all this completed and logged in … poke around if all is ok.

then proceed if you want to do bench update

ok so did this
redid everything and as per your suggestion i didnt setup anything
restored database
and then tried to login
and get this error

ImportError: Module import failed for E Commerce Settings (frappe.core.doctype.e_commerce_settings.e_commerce_settings Error: No module named ‘frappe.core.doctype.e_commerce_settings’)

do you thing i should do a bench update and try
shew this is a nightmare

Are you installing both frappe and erpnext from develop branch ?

whats the output for

bench version

admin@Home-Laptop:~/books/shamz-bench> bench version
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

erpnext 13.x.x-develop
frappe 14.x.x-develop

hello based on the error there’s a duplicate in the address doctype, I believe the is_your_company_address already exists in the core but you had it also in your customizations try removing the other is_your_company_address field.