
Sanjay Sikdar
Exception: Can not find valid pkg-config name.
Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
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.
note: This error originates from a subprocess, and is likely not a problem with pip.sudo apt install libmysqlclient-dev
# OR
sudo apt install libmariadb-dev-compatYou can use the mysql_config command to retrieve this information.
Now you need to Set the MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS environment variable.
mysql_config --cflags
# OUTPUT: -I/usr/include/mysql
mysql_config --libs
# OUTPUT: -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lz -lzstd -lssl -lcrypto -lresolv -lmSet the MYSQLCLIENT_CFLAGS environment variable. Replace '' with the path you obtained from the mysql_config --cflags command. Run the following command: export MYSQLCLIENT_CFLAGS="-I"
export MYSQLCLIENT_CFLAGS="-I/usr/include/mysql"Set the MYSQLCLIENT_LDFLAGS environment variable. Replace '' with the path you obtained from the mysql_config --libs command. Run the following command: export MYSQLCLIENT_LDFLAGS="-L" Note: If your MySQL installation includes multiple libraries, separate each library path with a space.
export MYSQLCLIENT_LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lz -lzstd -lssl -lcrypto -lresolv -lm"Now, when you install packages that require the MySQL client library.
pip install mysqlclientAdditional:
sudo apt-get install pkg-config build-essential
sudo bash -c "apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get -y clean"