Solve EnvironmentError: mysql_config not found Mysql-Python pip on Ubuntu


If you installing MySQL-python from pip in Ubuntu and see this error :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Downloading/unpacking MySQL-python==1.2.3 (from -r requirements.txt (line 3))
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package MySQL-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/ubuntu/.virtualenvs/trip/build/MySQL-python/setup.py", line 15, 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 24, 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: mysql_config: not found

Traceback (most recent call last):

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

  File "/home/ubuntu/.virtualenvs/trip/build/MySQL-python/setup.py", line 15, 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 24, in mysql_config

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

EnvironmentError: mysql_config not found

—————————————-
Command python setup.py egg_info failed with error code 1 in /home/ubuntu/.virtualenvs/trip/build/MySQL-python
Storing complete log in /home/ubuntu/.pip/pip.log
(trip) ubuntu@ubuntu:~/Tripvillas/tripvillas[yodi]$ pip install -r requirements.txt
Downloading/unpacking git+https://github.com/yuchant/django-mailer.git (from -r requirements.txt (line 11))
  Cloning https://github.com/yuchant/django-mailer.git to /tmp/pip-PUZNs4-build
  Running setup.py egg_info for package from git+https://github.com/yuchant/django-mailer.git
   
Downloading/unpacking http://labix.org/download/python-dateutil/python-dateutil-1.5.tar.gz (from -r requirements.txt (line 26))
  Downloading python-dateutil-1.5.tar.gz (232Kb): 232Kb downloaded
  Running setup.py egg_info for package from http://labix.org/download/python-dateutil/python-dateutil-1.5.tar.gz
   
Downloading/unpacking Django==1.3.1 (from -r requirements.txt (line 2))
  Running setup.py egg_info for package Django
   
Downloading/unpacking MySQL-python==1.2.3 (from -r requirements.txt (line 3))
  Running setup.py egg_info for package MySQL-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, 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 24, 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: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, 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 24, in mysql_config

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

EnvironmentError: mysql_config not found

—————————————-

This mean you should install libmysqlclient-dev. On Ubuntu 11.10 Oneiric :

1
sudo apt-get install libmysqlclient-dev libmysqlclient-dev libmysqlclient16

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.