I’m getting the following error message while running my Django REST project with MySQL database in pipenv.
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
This seems like a very common problem (please don’t mark as duplication), but after trying all the possible solutions I’m still getting the same issue..
A few things I tried:
pip3 install mysqlclient
pip3 install python3.6-dev
pip3 install mysql-client
pip3 install libsqlclient-dev
pip3 install libssl-dev
What could still be the problem?
It’s a Linux Ubuntu 18.04 server with Plesk. Python version 3.8.
3
Answers
I had to install this.
Now it works.
You should install libmysqlclient-dev:
sudo apt-get install libmysqlclient-dev
mysqlclient
has a dependency on the mysql client & dev packages being installed. In order to fix this on ubuntu, you have to useapt-get
to install a couple of mysql packages.In your case, it looks like the missing
mysql_config
might be missing on your system. You can fix that by installinglibmysqlclient-dev
on ubuntu bionic.another way
install the follwing packages.
other method
Then, edit the init.py file in your project origin dir(the same as settings.py)
add: