Question:
I’m running the following commands and get the following error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
root# sudo python manage.py syncdb Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py", line 7, in from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/lib/pymodules/python2.6/django/core/management/sql.py", line 5, in from django.contrib.contenttypes import generic File "/usr/lib/pymodules/python2.6/django/contrib/contenttypes/generic.py", line 6, in from django.db import connection File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 77, in connection = connections[DEFAULT_DB_ALIAS] File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 91, in __getitem__ backend = load_backend(db['ENGINE']) File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 32, in load_backend return import_module('.base', backend_name) File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.6/django/db/backends/mysql/base.py", line 14, in raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory |
I have a feeling that mysqldb isn’t configured properly with django, I was wondering if i’m missing anything. i ran the following commands right before it:
1 2 3 |
# apt-get install python-django # apt-get install python-mysqldb |
Answer:
I had this same issue where my virtualenv was broken and could no longer run django when I upgraded to ubuntu 12.04.
I simply ran (while my ve was active)
1 2 |
pip uninstall MySQL-python |
and then re-installed it with
1 2 |
pip install MySQL-python |
worked fine again after that.