OSError: mysql_config not found

When installing the python mysqlclient module with pip, I got the error “OSError: mysql_config not found”.

(venv) root@sok:~# pip install mysqlclient
Collecting mysqlclient
Downloading mysqlclient-2.1.0.tar.gz (87 kB)
|████████████████████████████████| 87 kB 1.2 MB/s
ERROR: Command errored out with exit status 1:
command: /root/venv/bin/python3 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/tmp/pip-install-r5qp0a97/mysqlclient/setup.py'”‘”‘; __file__='”‘”‘/tmp/pip-install-r5qp0a97/mysqlclient/setup.py'”‘”‘;f=getattr(tokenize, ‘”‘”‘open'”‘”‘, open)(__file__);code=f.read().replace(‘”‘”‘\r\n'”‘”‘, ‘”‘”‘\n'”‘”‘);f.close();exec(compile(code, __file__, ‘”‘”‘exec'”‘”‘))’ egg_info –egg-base /tmp/pip-install-r5qp0a97/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-r5qp0a97/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File ““, line 1, in
File “/tmp/pip-install-r5qp0a97/mysqlclient/setup.py”, line 15, in
metadata, options = get_config()
File “/tmp/pip-install-r5qp0a97/mysqlclient/setup_posix.py”, line 70, in get_config
libs = mysql_config(“libs”)
File “/tmp/pip-install-r5qp0a97/mysqlclient/setup_posix.py”, line 31, in mysql_config
raise OSError(“{} not found”.format(_mysql_config_path))
OSError: mysql_config not found
mysql_config –version
mariadb_config –version
mysql_config –libs
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
(venv) root@sok:~#

The error is fixed by installing MySQL development library.

On Ubuntu server with MariaDB, i installed

For MySQL, you can use

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *