Home > Software engineering >  Problem installing mysqlclient for Django project (macOS)
Problem installing mysqlclient for Django project (macOS)

Time:09-22

When connecting my Django project to a database hosted on a remote VM, when I run python3 manage.py run server I get the error

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

when I try python3 -m pip install mysqlclient to resolve the dependency, I get the error

ERROR: Could not find a version that satisfies the requirement mysqlclient (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3)
ERROR: No matching distribution found for mysqlclient

I'd like to understand what is causing these issues and how to resolve it.

Thanks in advance!

CodePudding user response:

I got it to work! For anyone facing the same issues run brew install mysql then try python3 manage.py runserver

CodePudding user response:

For what it's worth, you might try installing the mysql-connector-c first. It seems heavy-handed to have to install MySQL to use a driver.

From: How to install Python MySQLdb module using pip?

Mac OS brew install mysql-connector-c

if that fails, try brew install mysql

  • Related