I’ve uninstalled, reinstalled uninstalled django reinstalled django… I’ve tried everything?!
Please help, I’m willing to pay!
File “/Users/johnbiddulph/Documents/SITES/py/coastrz/.venv/lib/python3.9/site-packages/django/db/backends/mysql/base.py”, line 17, in
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
here is my requirements:
asgiref>=3.7.2
django>=4.2.11
django-cors-headers>=4.3.1
djangorestframework>=3.14.0
mysqlclient>=2.2.4
pillow>=10.2.0
pip>=24.0
pytz>=2024.1
setuptools>=58.0.4
sqlparse>=0.4.4
typing_extensions>=4.10.0
I’m getting:
Exception: Can not find valid pkg-config name.
Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
when I try install from requirements.txt
Look for your distro-specific package for the mysql client for the system you are using. For example, in my Ubuntu 22.04 system, it’s called libmysqlclient21.
I had this issues recently though. to solve it i used solution from this stackoverflow thread(https://stackoverflow.com/questions/76585758/mysqlclient-cannot-install-via-pip-cannot-find-pkg-config-name-in-ubuntu/76801424#76801424)
step 1: run → sudo apt-get update
step 2: sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
step 3: sudo apt install pkg-config
step 4: pip install mysqlclient
if it fails then manually point to the MYSQLCLIENT_LDFLAGS and MYSQLCLIENT_CFLAGS environment variable with or replace with appropriate paths
----> sudo MYSQLCLIENT_CFLAGS=“-I/usr/include/mysql” MYSQLCLIENT_LDFLAGS=“-L/usr/lib/x86_64-linux-gnu -lmysqlclient”
run step 4 again and it should go this time
Blockquote