Error while installing non_profit app (V15)

i can not install non_profit on new fresh site and facing this error
any help

frappe-bench$ bench --site nonprofit install-app non_profit
App erpnext already installed

Installing non_profit…
An error occurred while installing non_profit: (‘Module Def’, ‘Non Profit’, IntegrityError(1062, “Duplicate entry ‘Non Profit’ for key ‘PRIMARY’”))
Traceback with variables (most recent call last):
File “apps/frappe/frappe/commands/”, line 462, in install_app
_install_app(app, verbose=context.verbose, force=force)
context = {‘sites’: [‘nonprofit’], ‘force’: False, ‘verbose’: False, ‘profile’: False}
apps = (‘non_profit’,)
force = False
_install_app = <function install_app at 0x7f2610063740>
filelock = <function filelock at 0x7f2610060c20>
exit_code = 0
site = ‘nonprofit’
app = ‘non_profit’
err = DuplicateEntryError(‘Module Def’, ‘Non Profit’, IntegrityError(1062, “Duplicate entry ‘Non Profit’ for key ‘PRIMARY’”))
File “apps/frappe/frappe/”, line 299, in install_app
add_module_defs(name, ignore_if_duplicate=force)
name = ‘non_profit’
verbose = False
set_as_patched = True
force = False
sync_jobs = <function sync_jobs at 0x7f260eedf920>
sync_for = <function sync_for at 0x7f260eef4720>
sync_customizations = <function sync_customizations at 0x7f2610195260>
sync_fixtures = <function sync_fixtures at 0x7f260eef4a40>
app_hooks = {‘after_install’: [‘non_profit.setup.setup_non_profit’], ‘app_color’: [‘grey’], ‘app_description’: [‘Non Profit’], ‘app_email’: [‘’], ‘app_icon’: [‘octicon octicon-file-directory’], ‘app_license’: [‘MIT’], ‘app_name’: [‘non_profit’], ‘app_publisher’: [‘Frappe’], ‘app_title’: [‘Non Profit’], ‘before_tests’: [‘non_profit.non_profit.utils.before_tests’], ‘doctype_js’: {‘Sales Invoice’: [‘public/js/payment_entry.js’]}, ‘global_search_doctypes’: {‘Non Profit’: [{‘doctype’: ‘Certified Consultant’, ‘index’: 1}, {‘doctype’: ‘Certification Application’, ‘index’: 2}, {‘doctype’: ‘Volunteer’, ‘index’: 3}, {‘doctype’: ‘Membership’, ‘index’: 4}, {‘doctype’: ‘Member’, ‘index’: 5}, {‘doctype’: ‘Donor’, ‘index’: 6}, {‘doctype’: ‘Chapter’, ‘index’: 7}, {‘doctype’: ‘Grant Application’, ‘index’: 8}, {‘doctype’: ‘Volunteer Type’, ‘index’: 9}, {‘doctype’: ‘Donor Type’, ‘index’: 10}, {‘doctype’: ‘Membership Type’, ‘index’: 11}]}, ‘override_doctype_class’: {‘Payment Entry’: ['non_profit.n…
installed_apps = [‘frappe’, ‘builder’, ‘erpnext’]
app = ‘erpnext’
required_app = ‘erpnext’
File “apps/frappe/frappe/”, line 638, in add_module_defs
d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate)
app = ‘non_profit’
ignore_if_duplicate = False
modules = [‘Non Profit’]
module = ‘Non Profit’
d = <ModuleDef: Non Profit>
File “apps/frappe/frappe/model/”, line 297, in insert
self = <ModuleDef: Non Profit>
ignore_permissions = True
ignore_links = None
ignore_if_duplicate = False
ignore_mandatory = None
set_name = None
set_child_names = True
File “apps/frappe/frappe/model/”, line 577, in db_insert
raise frappe.DuplicateEntryError(self.doctype,, e)
self = <ModuleDef: Non Profit>
ignore_if_duplicate = False
conflict_handler = ‘’
d = {‘name’: ‘Non Profit’, ‘creation’: ‘2024-03-20 03:02:24.944236’, ‘modified’: ‘2024-03-20 03:02:24.944236’, ‘modified_by’: ‘Administrator’, ‘owner’: ‘Administrator’, ‘docstatus’: 0, ‘idx’: 0, ‘module_name’: ‘Non Profit’, ‘custom’: 0, ‘package’: None, ‘app_name’: ‘non_profit’, ‘restrict_to_domain’: None, ‘_user_tags’: None, ‘_comments’: None, ‘_assign’: None, ‘_liked_by’: None}
columns = [‘name’, ‘creation’, ‘modified’, ‘modified_by’, ‘owner’, ‘docstatus’, ‘idx’, ‘module_name’, ‘custom’, ‘package’, ‘app_name’, ‘restrict_to_domain’, ‘_user_tags’, ‘_comments’, ‘_assign’, ‘_liked_by’]
frappe.exceptions.DuplicateEntryError: (‘Module Def’, ‘Non Profit’, IntegrityError(1062, “Duplicate entry ‘Non Profit’ for key ‘PRIMARY’”))

ok solved
install payment
bench get app payments
delete from tabModule Def WHERE NAME LIKE '%ofit%';
install payment
bench --site {sitename} install-app payment
that is it

Hi @tayeb_rashed,

I’ve shared a suggestion:
If you’ve installed ERPNext in version 15, make sure the payment is also in version 15 to prevent errors.

If the payment is in the development branch, switch to it:

bench switch-to-branch version-15 payments

If you’ve uninstalled or installed the app, do this:

bench get-app --branch version-15 payments

This is because the payments app has a version 15 branch.

I hope this is clear and helpful.

Thank You!

Thanks for your reply
Do you mean if we used payment in v15 the error will not appear?
Did you give it try?
If sure this will be very helpful

Yes @tayeb_rashed

1 Like

Thanks @NCP
This awesome :sunglasses: