Hello , I am a Macbook Air M1 user, and during bench’s new site creation after getting the app , i am getting below error
(frappe-bench-venv) sathishkannan@Sathishs-MacBook-Air frappe-bench % bench new-site press.localhost
Enter mysql super user [root]:
MySQL root password:
Traceback (most recent call last):
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/commands/site.py”, line 112, in new_site
_new_site(
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/installer.py”, line 84, in _new_site
install_db(
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/installer.py”, line 165, in install_db
setup_database(force, verbose, mariadb_user_host_login_scope)
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/database/init.py”, line 18, in setup_database
return frappe.database.mariadb.setup_db.setup_database(force, verbose, mariadb_user_host_login_scope)
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/database/mariadb/setup_db.py”, line 27, in setup_database
root_conn = get_root_connection()
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/database/mariadb/setup_db.py”, line 143, in get_root_connection
frappe.local.flags.root_connection = frappe.database.get_db(
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/database/init.py”, line 79, in get_db
import frappe.database.mariadb.mysqlclient
File “/Users/sathishkannan/code/frappe-bench/apps/frappe/frappe/database/mariadb/mysqlclient.py”, line 4, in
import MySQLdb
File “/Users/sathishkannan/code/frappe-bench/env/lib/python3.10/site-packages/MySQLdb/init.py”, line 17, in
from . import _mysql
ImportError: dlopen(/Users/sathishkannan/code/frappe-bench/env/lib/python3.10/site-packages/MySQLdb/_mysql.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace ‘_mysql_affected_rows’
Site creation failed, do you want to rollback the site? [y/N]:
Aborted!
the mysql client installed within Bench automatically defaults to intel and throws this error.
I found a similar issue here. Macos M1 mysqlclient Symbol not found: _mysql_affected_rows ERROR · Issue #496 · PyMySQL/mysqlclient · GitHub. however installing mysqlclient still fails and i couldn’t fix this issue.
Tried with python 3.12 and python 3.10 and followed the steps in frappe framework documentation for setting up the app.
If anyone has faced similar issue and fixed it, please do let me know how it can be done. Thank you.