EnvironmentError: mysql_config not found [duplicate]
Asked Answered
B

2

6

EnvironmentError: mysql_config not found, while installing MySQL-python

Could someone advice me on what to do? I did the following from my-side:

Error I got while installing with pip:

  [email protected]:~$ sudo pip install MySQL-python
    Downloading/unpacking MySQL-python
    Downloading MySQL-python-1.2.4.zip (113kB): 113kB downloaded
    Running setup.py egg_info for package MySQL-python
    sh: 1: mysql_config: not found
 Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "/tmp/pip_build_root/MySQL-python/setup.py", line 18, in <module>
    metadata, options = get_config()
  File "setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Complete output from command python setup.py egg_info:
sh: 1: mysql_config: not found

Traceback (most recent call last):

 File "<string>", line 16, in <module>

 File "/tmp/pip_build_root/MySQL-python/setup.py", line 18, in <module>

metadata, options = get_config()

File "setup_posix.py", line 43, in get_config

libs = mysql_config("libs_r")

File "setup_posix.py", line 25, in mysql_config

raise EnvironmentError("%s not found" % (mysql_config.path,))

  EnvironmentError: mysql_config not found

   ----------------------------------------
 Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_roo

I am running UBUNTU 12.04 LTS on my comp.

Installing manually gives the same error. I tried easy_install, it didn't help either.

I searched for mysql_config manually, i couldn't find it any where in by system files.

After a quick search i have found out that mysql_config belongs to libmysqlclient-dev. So, i tried getting these packages using:

 sudo apt-get install libmysqlclient-dev

It gave the following output:

  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  Package libmysqlclient-dev is not available, but is referred to by another package.
  This may mean that the package is missing, has been obsoleted, or
  is only available from another source
  However the following packages replace it:
  mysql-server-5.5

  E: Package 'libmysqlclient-dev' has no installation candidate

I even downloaded libmysqlclient-dev packages from the source and tried installing them manually, it's giving dependency errors. Following is the output while installing.

  ubuntu@ubuntu:~/Downloads$ sudo dpkg -i libmysqlclient-dev_5.5.32-            0ubuntu0.12.04.1_amd64.deb 
  Selecting previously unselected package libmysqlclient-dev.
  (Reading database ... 203659 files and directories currently installed.)
   Unpacking libmysqlclient-dev (from libmysqlclient-dev_5.5.32-0ubuntu0.12.04.1_amd64.deb) ...
  dpkg: dependency problems prevent configuration of libmysqlclient-dev:
  libmysqlclient-dev depends on libmysqlclient18 (= 5.5.32-0ubuntu0.12.04.1); however:
  Version of libmysqlclient18 on system is 5.5.33+dfsg-1.
  dpkg: error processing libmysqlclient-dev (--install):
  dependency problems - leaving unconfigured
  Processing triggers for man-db ...
  Errors were encountered while processing:
  libmysqlclient-dev
Bradshaw answered 16/10, 2013 at 6:29 Comment(0)
P
6

To sum up some of the solutions provided in other SO questions (and basing on the error output). Firstly,

sudo apt-get update

So what it does is

Used to re-synchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list(5).

And could solve

dpkg: dependency problems prevent configuration of libmysqlclient-dev

Run the following afterwards if sudo apt-get install libmysqlclient-dev still doesn't work

sudo apt-get install python-dev

sudo apt-get install python-mysqldb

Finally, check if mysql_config is in your PATH; add if necessary

export PATH=$PATH:/path/to/your/mysql_config

To possibly solve

EnvironmentError: mysql_config not found

Similar:

Psi answered 23/10, 2015 at 8:9 Comment(0)
O
0

Try to add apt-get source list, and use apt-get to install, which may prevent the dpkg error.

Check this: https://www.howtoinstall.co/en/ubuntu/trusty/libmariadbclient-dev

Obstipation answered 9/5, 2014 at 1:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.