Issue
I am trying to pip install mysqlclient
on Ubuntu 22.04 but get
Collecting mysqlclient
Using cached mysqlclient-2.2.0.tar.gz (89 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
/bin/sh: 1: pkg-config: not found
/bin/sh: 1: pkg-config: not found
Trying pkg-config --exists mysqlclient
Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
Trying pkg-config --exists mariadb
As per the comments on this question I did
apt-get -y install python3-dev gcc build-essential libmysqlclient-dev
note that ls /usr/include/mysql/
and ls /usr/lib/x86_64-linux-gnu/libmysqlclient.*
show that libmysqlclient is installed and mysql headers are in place.
What else is missing?
Solution
Setting
MYSQLCLIENT_CFLAGS="-I/usr/include/mysql"
MYSQLCLIENT_LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lmysqlclient"
worked for me, as per this answer.
Answered By - spraff Answer Checked By - Candace Johnson (WPSolving Volunteer)