Error loading MySQLdb module

Hi,

I need some help fixing the below error.  I'm using Mac OS X version 10.7.3. 

Thank you.

/Library/Frameworks/Python.framework/Versions/2.7/bin/python manage.py runserver 127.0.0.1:8000

Traceback (most recent call last):

  File "manage.py", line 10, in <module>

    execute_from_command_line(sys.argv)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 443, in execute_from_command_line

    utility.execute()

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 382, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/core/management/base.py", line 196, in run_from_argv

    self.execute(*args, **options.__dict__)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/core/management/base.py", line 217, in execute

    translation.activate('en-us')

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/utils/translation/__init__.py", line 105, in activate

    return _trans.activate(language)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/utils/translation/trans_real.py", line 194, in activate

    _active.value = translation(language)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/utils/translation/trans_real.py", line 183, in translation

    default_translation = _fetch(settings.LANGUAGE_CODE)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/utils/translation/trans_real.py", line 160, in _fetch

    app = import_module(appname)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/utils/importlib.py", line 35, in import_module

    __import__(name)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/contrib/admin/__init__.py", line 3, in <module>

    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/contrib/admin/helpers.py", line 2, in <module>

    from django.contrib.admin.util import (flatten_fieldsets, lookup_field,

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/contrib/admin/util.py", line 1, in <module>

    from django.db import models

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/db/__init__.py", line 40, in <module>

    backend = load_backend(connection.settings_dict['ENGINE'])

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/db/__init__.py", line 34, in __getattr__

    return getattr(connections[DEFAULT_DB_ALIAS], item)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/db/utils.py", line 92, in __getitem__

    backend = load_backend(db['ENGINE'])

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/db/utils.py", line 24, in load_backend

    return import_module('.base', backend_name)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/utils/importlib.py", line 35, in import_module

    __import__(name)

  File "/Library/Python/2.7/site-packages/Django-1.4-py2.7.egg/django/db/backends/mysql/base.py", line 16, in <module>

    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named pkg_resources

1 comment
Comment actions Permalink

Hi Julio,

Did you by any chance upgrade your original Mac OS X supplied Python?

I've seen similar errors in that situation. In any case, judging by the message, something is probably wrong with your setuptools package. Just try to (re)install it, by running:

easy_install setuptools

...outside any virtualenv, in case you use them.

Hope that helps,

Rubens

0

Please sign in to leave a comment.