Mutable Ideas

Notes and ideas about Java, Scala, Big Data, NoSQL, Quality and Software Deploy

Installing Mysql-python on Macosx

I faced some bumps trying to install mysql-python on my Mac OSX. I didn’t have MySQL installed on my computer because I use Vagrant to keep specific development environments accord with each project I’m work on.

During the first try I got error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ sudo pip install mysql-python
Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/private/tmp/pip_build_root/mysql-python/setup.py", line 17, 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: mysql_config: command not found

The important part is: sh: mysql_config: command not found, and mysql_config is part of mysql installation! So I had to install mysql and add it to the PATH on my computer:

1
2
3
4
5
6
$ brew install mysql

$ export PATH=${PATH}:/usr/local/mysql/bin

$ which mysql_config
/usr/local/bin/mysql_config

After that, running the same command again, and many warnings later it worked:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ sudo pip install mysql-python
Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py egg_info for package mysql-python

Installing collected packages: mysql-python
  Running setup.py install for mysql-python
    building '_mysql' extension
    ...
    ...
    ...
    ...
Successfully installed mysql-python
Cleaning up...

Checking out a great tutorial now.

Enjoying Pythoning!