Error while installing erpnext to our app

erpnext@RinTrick:/home/bench/erpnext$ bench --site install-app erpnext

Installing erpnext…
An error occurred while installing erpnext: (‘Module Def’, ‘Accounts’, IntegrityError(1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”))
Traceback (most recent call last):
File “apps/frappe/frappe/model/”, line 411, in db_insert
File “apps/frappe/frappe/database/”, line 187, in sql
self._cursor.execute(query, values)
File “env/lib/python3.10/site-packages/pymysql/”, line 148, in execute
result = self._query(query)
File “env/lib/python3.10/site-packages/pymysql/”, line 310, in _query
File “env/lib/python3.10/site-packages/pymysql/”, line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “env/lib/python3.10/site-packages/pymysql/”, line 775, in _read_query_result
File “env/lib/python3.10/site-packages/pymysql/”, line 1156, in read
first_packet = self.connection._read_packet()
File “env/lib/python3.10/site-packages/pymysql/”, line 725, in _read_packet
File “env/lib/python3.10/site-packages/pymysql/”, line 221, in raise_for_error
File “env/lib/python3.10/site-packages/pymysql/”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/commands/”, line 293, in install_app
_install_app(app, verbose=context.verbose)
File “apps/frappe/frappe/”, line 184, in install_app
File “apps/frappe/frappe/”, line 507, in add_module_defs
File “apps/frappe/frappe/model/”, line 312, in save
return self._save(*args, **kwargs)
File “apps/frappe/frappe/model/”, line 334, in _save
return self.insert()
File “apps/frappe/frappe/model/”, line 278, in insert
raise e
File “apps/frappe/frappe/model/”, line 275, in insert
File “apps/frappe/frappe/model/”, line 436, in db_insert
raise frappe.DuplicateEntryError(self.doctype,, e)
frappe.exceptions.DuplicateEntryError: (‘Module Def’, ‘Accounts’, IntegrityError(1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”))

The solution could be just updating with

bench update

other solution is to purge the app Accounts from erpnext like this post, but you will not be able to use Accounts Model