Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3 - Pipenv install mysqlclient?

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

like image 239
user2239318 Avatar asked May 30 '18 12:05

user2239318


People also ask

Does Mysqlclient support Python 3?

This project is a fork of MySQLdb1. This project adds Python 3 support and fixed many bugs.


2 Answers

You probably need the mysql client lib for the OS.

sudo apt install libmysqlclient-dev

Then you should be able to:

pipenv install mysqlclient
like image 110
ForFunAndProfit Avatar answered Sep 21 '22 14:09

ForFunAndProfit


I fixed that problem with the following command:

brew install mysql
like image 28
Lukas Schönsgibl Avatar answered Sep 21 '22 14:09

Lukas Schönsgibl