Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: Mysql-python installation error

When trying to install requirements.txt for Django I get the following error when trying to install Mysql-python

Traceback (most recent call last):

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

  File "/home/abercrrl/.virtualenvs/django_at/build/MySQL-python/setup.py", line 7, in <module>

    use_setuptools()

  File "distribute_setup.py", line 145, in use_setuptools

    return _do_download(version, download_base, to_dir, download_delay)

  File "distribute_setup.py", line 125, in _do_download

    _build_egg(egg, tarball, to_dir)

  File "distribute_setup.py", line 116, in _build_egg

    raise IOError('Could not build the egg.')

IOError: Could not build the egg.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/abercrrl/.virtualenvs/django_at/build/MySQL-python
Storing debug log for failure in /home/abercrrl/.pip/pip.log

Note that I have tried:

pip install --upgrade setuptools 

Setuptools is already up-to-date


Edit:

I modified the following command to match my locations:

echo "mysql_config = /usr/bin/mysql_config" >> ~/.virtualenvs/django_at/build/MySQL-python/site.cfg

I did have to create the build and MySQL-python directories for this to work. The command ran fine, however now I am getting this now: https://gist.github.com/rlabercrombie/8725074

like image 266
richard008 Avatar asked Jan 30 '14 23:01

richard008


1 Answers

you must install mysql dev and all required libraries in order to mysql-python to be build: sudo apt-get install build-essential python-dev libmysqlclient-dev python-mysqldb. See for details http://mysql-python.blogspot.no/2012/11/is-mysqldb-hard-to-install.html or https://stackoverflow.com/a/7461662/3219121

like image 118
matagus Avatar answered Sep 17 '22 03:09

matagus