Search code examples
mysqldjangolinuxdjango-rest-frameworkmysql-python

Linux Ubuntu 18.04 - Error loading MySQLdb module. Did you install mysqlclient?


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.


Solution

  • I had to install this.

    sudo apt install libpython3.8-dev
    

    Now it works.