Python Forum
Pip install for mysqlclient not working
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pip install for mysqlclient not working
#1
I'm trying to install the mysqlclient with Pip, and get an error as follows.

$ pip3.4 install mysqlclient Downloading/unpacking mysqlclient Downloading mysqlclient-1.3.12.tar.gz (89kB): 89kB downloaded Running setup.py (path:/tmp/pip_build_root/mysqlclient/setup.py) egg_info for package mysqlclient /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 17, in <module> File "/tmp/pip_build_root/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "/tmp/pip_build_root/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") File "/tmp/pip_build_root/mysqlclient/setup_posix.py", line 26, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) OSError: mysql_config not found Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 17, in <module> File "/tmp/pip_build_root/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "/tmp/pip_build_root/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") File "/tmp/pip_build_root/mysqlclient/setup_posix.py", line 26, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) OSError: mysql_config not found ---------------------------------------- Cleaning up...
From what I could tell, this means it's missing a library, so I downloaded and installed the RPMs for the Python and C++ libraries from Oracle's site. These are the mysql RPMs installed on the system:

$ rpm -qa | grep -i mysql mysql-connector-python-2.1.7-1.el6.x86_64 MySQL-server-advanced-5.6.30-1.el6.x86_64 mysql-connector-c++-1.1.9-1.x86_64 MySQL-client-advanced-5.6.30-1.el6.x86_64 MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 MySQL-shared-compat-advanced-5.6.22-1.el6.x86_64 
Yet, it seems that mysql_config still not installed, and so is not found:

$ locate mysql_config /usr/bin/mysql_config_editor /usr/share/man/man1/mysql_config_editor.1.gz
Note that some sites say to install libmysqlclient-dev, which I think would apply if I'm installing the RPMs from Redhat. But my departmental standard is to use the ones supplied by Oracle, which are the ones that appear above.

These are my versions:

$ pip3.4 -V pip 1.5.6 from /usr/local/lib/python3.4/site-packages (python 3.4) $ python3.4 -V Python 3.4.2
Anybody know which RPM I need to install?
Reply
#2
if your on ubuntu
sudo apt-get install libmysqlclient-dev python-dev
Recommended Tutorials:
Reply
#3
Notice you have not a shell command called "mysql_config"

Using yum
Quote:yum provides mysql_config

In my case, I should install mariadb-devel
Quote:yum install mariadb-devel

If you get gcc error, please check this post
https://stackoverflow.com/questions/3632...centos-7-2

Hope this help!
Reply
#4
This error may pop up due to lack of dependencies and libraries. Follow these steps before pip install mysqlclient.
For Debian / Ubuntu
Quote:sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
sudo apt-get install zlib1g-dev
If this didn't worked try checking this Solution for Django MySQLClient pip compile failure on Linux Arrow Heart
Reply
#5
In general, if you're compiling something, you're going to want the -dev packages. The runtime libraries are normally not enough to compile something with. This applies pretty much across the board with linux, and is not related to python.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My minoconda3 install is not working. Led_Zeppelin 1 2,770 Jan-26-2022, 09:49 PM
Last Post: snippsat
  install.bat pymem not working? ChickenNugget 1 3,088 Oct-31-2021, 02:04 PM
Last Post: snippsat
  TA-Lib pip install not working Mac (Fix Found) DrinkinBeer 3 15,544 Jan-15-2021, 03:04 AM
Last Post: DrinkinBeer
  please help me to install mysqlclient!!! njnkhanal 1 4,484 Jan-20-2020, 07:51 AM
Last Post: buran
  Can't install mysqlclient on mac Gabn123 5 7,167 Dec-25-2019, 06:54 AM
Last Post: Larz60+
  trying to locate a working grpc to install MrMajorThorburn 6 10,038 May-10-2019, 01:19 PM
Last Post: MrMajorThorburn
  mysqlclient gregbarsd 0 4,957 Sep-26-2018, 05:55 AM
Last Post: gregbarsd

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.