"Error loading MySQLdb module" when installing custom app

I am installing a custom app that needs MySQL, which I already had working so I am a bit confused on what's going on.

Anyways here is the error:

Error loading MySQLdb module: this is MySQLdb version (1, 2, 4, 'final', 1), but _mysql is version (1, 2, 3, 'final', 0

Tried

sudo pip uninstall MySQL-python

then

sudo pip install MySQL-python

which worked...

Successfully installed MySQL-python

still the same error

Error loading MySQLdb module: this is MySQLdb version (1, 2, 4, 'final', 1), but _mysql is version (1, 2, 3, 'final', 0
6

1 Answer

It seems that apt-get and pip each installed their own version of the library.

Try removing system MySQL with sudo apt-get remove python-mysqldb, and you should have something like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED: python-mysqldb
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
After this operation, 196 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 109333 files and directories currently installed.)
Removing python-mysqldb (1.2.3-2ubuntu1) ...

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like