Error loading MySQLdb module: No module named MySQLdb

Asked by neo0

I am trying to install Dashboard following this guide http://wiki.openstack.org/OpenStackDashboard.
When I sync database, I had this error:

# tools/with_venv.sh openstack-dashboard/manage.py syncdb

File "/home/user1/horizon/.venv/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

I use Ubuntu server 11.10 amd64 and I installed "python-mysqldb".
When I test in Python interpreter, it's ok.
>>> import MySQLdb

I also tried to install by:
~/horizon# easy_install MySQL-python
but it only returns that:

Searching for mysql-python
Best match: MySQL-python 1.2.3
MySQL-python 1.2.3 is already the active version in easy-install.pth

Using /usr/lib/pymodules/python2.7
Processing dependencies for mysql-python
Finished processing dependencies for mysql-python

What's wrong in this case?
Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Dashboard (Horizon) Edit question
Assignee:
No assignee Edit question
Solved by:
Rafael Durán Castañeda
Solved:
Last query:
Last reply:
Revision history for this message
Best Rafael Durán Castañeda (rafadurancastaneda) said :
#1

Hi,

I think you didn't install MySQL-python on your virtualenv, If I'm right you can install just doing:

$ source .venv/bin/activate
$ pip install MySQL-python

or:

$ tools/with_venv.sh pip install MySQL-python

Revision history for this message
neo0 (tungns-inf) said :
#2

Thanks Rafael Durán Castañeda, that solved my question.

Revision history for this message
Akhilesh (akhi1990khalari) said :
#3

Hi

While running ./stack.sh followed steps from docs.devstack.org I am getting below error :

+ recreate_database_ keystone utf8
/home/stack/devstack/lib/database: line 103: recreate_database_: command not found
+ exit_trap
+ local r=127
++ jobs -p
+ jobs=
+ [[ -n '' ]]
+ kill_spinner
+ '[' '!' -z '' ']'
+ [[ 127 -ne 0 ]]
+ echo 'Error on exit'
Error on exit
+ ./tools/worlddump.py -d
usage: worlddump.py [-h] [-d DIR]
worlddump.py: error: argument -d/--dir: expected one argument

Please let me know what is the issue.