Python3 – Pipenv install thesqlclient

mysql-pythonpython

Trying to install from pipenv with:

pipenv install mysqlclient

will reseult in:

Installing mysqlclient… Collecting mysqlclient Using cached
https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-5vhtqgve/mysqlclient/setup.py", line 17, in
metadata, options = get_config()
File "/tmp/pip-install-5vhtqgve/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-install-5vhtqgve/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found

----------------------------------------

Error: An error occurred while installing mysqlclient! Command
"python setup.py egg_info" failed with error code 1 in
/tmp/pip-install-5vhtqgve/mysqlclient/

This is likely caused by a bug in mysqlclient. Report this to its
maintainers.

I'm using a Debian and with another virtualenv it get the system package

python-mysqldb/testing,now 1.3.10-1 amd64 

Pipenv won't use this one and won't install the other.
How can I solve this?
Thanks,BR

Best Answer

You probably need the mysql client lib for the OS.

sudo apt install libmysqlclient-dev

Then you should be able to:

pipenv install mysqlclient
Related Topic