Reputation: 165
I am setting up local workspace for my Django project with MySQL on a Macbook AIR with M2 chip. All config are migrated from my old Macbook Pro with core i7 using OSX Migration Assistant.
I am having problem trying to run server on my local, i.e. python manage.py runserver
. The err msg is:
File "/Users/.../.venv/lib/python3.10/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/__init__.py", line 24, in <module>
version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined
mysql -u root -p
mysqlclient
is installed, the version is 2.1.1
MySQLdb
directly using python console, it seems python is having difficulty using dlopen
to open the "c compiled" (not sure how this is called exactly) file, or it opened but there was error? Error as:Python 3.10.6 (v3.10.6:9c7b4bd164, Aug 1 2022, 17:13:48) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/_mysql.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_mysql_affected_rows'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/__init__.py", line 24, in <module>
version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined
python -m pip download mysqlclient==2.1.1 --no-binary :all:
, no luck.Thanks for advance!
Upvotes: 1
Views: 2089
Reputation: 1
I'm also running into this issue.
MacOS 13.4.1 Python 3.10.0
I accidentally upgraded to MySQL 8.1 using brew and the libmysqlclient.21.dylib no longer exists, but libmysqlclient.22.dylib. Both my mysql and mysql-client are using this new dylib file.
It appears that mysqlclient==2.2.0 is still looking for libmysqlclient.21.dylib.
I've tried reverting back to MySQL 8.0.34, but now my database fails saying it can no longer go backwards due to the upgrade: "[InnoDB] Cannot boot server version 80034 on data directory built by version 80100. Downgrade is not supported"
--
I've opened a discussion about it with the PyMySQL github: https://github.com/PyMySQL/mysqlclient/discussions/652
Upvotes: 0