views:

883

answers:

1

I created a virtualbox with a fresh install of ubuntu 9.10.

I am trying to get MySQLdb to run on python but I'm failing at the import MySQLdb

I first tried sudo easy_install MySQL_python-1.2.3c1-py2.6-linux-i686.egg and then sudo apt-get install python-mysqldb.

Both apparently installed ok, but gave me the following error message when in python I have the import line:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/MySQLdb/__init__.py", line 19, in <module>

File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 7, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory

I have already installed MySQL and it is running, if that matters at all. I tried following this, but failed in step 2

+3  A: 

Your MySQLdb egg installation looks like it is not working properly. You should go into /usr/local/lib/python2.6/dist-packages and remove it.

The Ubuntu python-mysqldb package should work fine. Unless you have a good reason, you should stick to your distribution's package manager when installing new software.

Cristian
Thanks. I went looking for instructions on how to install it and the egg was the first one that I found. Your answer solved it immediately. I assumed I had to reinstall the apt-get install python-mysqldb but after deleting the egg I tried the import and it worked. So it installs to different places? I had looked for it in the Applications/Software center but since it wasn't there and the sourceforge page didn't have instructions, I went elsewhere online...
greye