WolfieZero
WolfieZero

Reputation: 387

Django / mysqlclient looking for missing `libmysqlclient.18.dylib` file

I've setup a Django (1.8.18) environment using virtualenv (Python 2.7.10) and also installed MariaDB (10.2.6) on my Mac via homebrew. Django is setup to use MySQL through the settings.py file and also I've installed mysqlclient.

When I runserver I get a error saying:

Error loading MySQLdb module: dlopen(/Users/wolfie/Code/django.thingy/.venv/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: /usr/local/opt/mariadb/lib/libmysqlclient.18.dylib

I've had a look in that /usr/local/opt/mariadb/lib/ folder and all I see close to that is

libmariadb.3.dylib

libmariadb.dylib -> libmariadb.3.dylib

Is there any reason why Django/mysqlclient is looking for for the wrong file or is it MariaDB is missing a file it should have?

Upvotes: 1

Views: 472

Answers (1)

Craig Slusher
Craig Slusher

Reputation: 11

I had this exact same issue. Once you activate your virtualenv, try the following:

env "CFLAGS=-I/usr/local/include -L/usr/local/lib -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install -U --force-reinstall mysql-python --no-cache-dir --no-binary mysql-python

Upvotes: 1

Related Questions