After installing OS X Mavericks, I have been having issues running django's server:
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/admin/forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/auth/forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/auth/models.py", line 48, in <module>
class Permission(models.Model):
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/models/base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/models/base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/models/options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 35, in <module>
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): dlopen(/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
Expected in: /usr/lib/libsqlite3.dylib
in /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
I think the issue is that the sqlite3 module has gone missing for some reason:
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python
Python 2.7.5 (default, Dec 31 2013, 11:46:08)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
Expected in: /usr/lib/libsqlite3.dylib
in /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
I'm not sure what is causing this. Isn't the sqlite3 module normally just part of Python?
Updating OS X is notorious for messing up all sorts of Developer Tools.
What is your output when you type which sqlite3? How about other developer tools like which gcc? If they are missing you may need to reinstall Xcode. I know many users had to reinstall XCode after updating to Mavericks.
Here's the link for more information: https://developer.apple.com/xcode/
Uninstalling and reinstalling python with brew seemed to help with the earlier problem. Of course now, python is broken in that virtual environment:
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python manage.py runserver
dyld: Library not loaded: #executable_path/../.Python
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/bin/python
Reason: image not found
Trace/BPT trap: 5
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python
dyld: Library not loaded: #executable_path/../.Python
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/bin/python
Reason: image not found
Trace/BPT trap: 5
Related
I'm working on a Rally reporting tool for my team in Python, and I'm trying to package it using cx-freeze. I'm getting a ModuleNotFound error, and I'm wondering if it's because pygal isn't supported by cx-freeze (really hoping this isn't the case because I'd have to rewrite a lot of things)
celinaperalta$ /Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyGUI ; exit;
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
module.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
exec(code, {'__name__': '__main__'})
File "RallyGUI.py", line 8, in <module>
File "/Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyReportTool.py", line 7, in <module>
import pygal
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygal/__init__.py", line 28, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 959, in <module>
class Environment:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 963, in Environment
self, search_path=None, platform=get_supported_platform(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 190, in get_supported_platform
plat = get_build_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 395, in get_build_platform
plat = get_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 675, in get_platform
get_config_vars(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 551, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 422, in _init_posix
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_darwin_darwin'
cx_freeze does not include all the packages automatically. When you find ModuleNotFoundError, you need to inlcude the module explicitly in your setup like -
build_exe_options = {'packages': ['_sysconfigdata_m_darwin_darwin']}
Here is my error trace of python manage.py runserver I am using django 1.10.7 with python 2.7
(faavenv) user#ubutnu:~/Documents/faa-backend$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 316, in execute
settings.INSTALLED_APPS
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 97, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named djangochat.settings
Here is my requirements.txt
amqp==2.2.1
anyjson==0.3.3
asn1crypto==0.22.0
Babel==2.4.0
backports-abc==0.5
bcrypt==3.1.3
BeautifulSoup==3.2.1
beautifulsoup4==4.6.0
billiard==3.5.0.3
bleach==2.0.0
boto==2.48.0
boto3==1.4.4
botocore==1.5.80
celery==4.1.0
certifi==2017.4.17
cffi==1.10.0
chardet==3.0.4
cryptography==1.9
Django==1.10.7
django-celery-beat==1.0.1
django-contrib-comments==1.8.0
django-debug-toolbar==1.8
django-environ==0.4.3
django-nocaptcha-recaptcha==0.0.19
django-storages-redux==1.3.3
docutils==0.13.1
enum34==1.1.6
Fabric==1.13.2
feedparser==5.2.1
filebrowser-safe==0.4.7
flower==0.9.2
future==0.16.0
futures==3.1.1
grappelli-safe==0.4.6
html5lib==0.999999999
idna==2.5
ipaddress==1.0.18
jmespath==0.9.3
kombu==4.1.0
Mezzanine==4.2.3
nltk==3.2.4
numpy==1.13.0
oauthlib==2.0.2
olefile==0.44
pandas==0.20.2
paramiko==2.2.1
Pillow==4.1.1
psycopg2==2.7.1
pyasn1==0.2.3
pycparser==2.17
pycryptodomex==3.4.6
pyjwkest==1.3.6
PyJWT==1.5.2
PyNaCl==1.1.2
python-dateutil==2.6.0
python-openid==2.2.5
pytz==2017.2
requests==2.18.1
requests-oauthlib==0.8.0
s3transfer==0.1.10
scikit-learn==0.18.2
scipy==0.19.1
singledispatch==3.4.0.3
six==1.10.0
sklearn==0.0
social-auth-app-django==1.2.0
social-auth-core==1.4.0
sqlparse==0.2.3
tornado==4.5.1
tzlocal==1.4
urllib3==1.21.1
vine==1.1.4
webencodings==0.5.1
Problem is that I haven't install Django chat in my environment. Still, it is showing above error. Not only this project but in all project, I am receiving this error.
I tried to reinstall all library again but doesn't help.
Any suggestion would be appreciated.
(faavenv) user#ubuntu:~/Documents/faa-backend$ python manage.py shell
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 316, in execute
settings.INSTALLED_APPS
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/home/user/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/home/soham/Documents/faa-backend/faavenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 97, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named djangochat.settings
(faavenv) user#ubuntu:~/Documents/faa-backend$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import djangoChat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named djangoChat
>>>
This error usually happens because you have a file that uses django and django is not imported.
You probably have a script somewhere in your project that is imported and has a executable function without the if __name__ == "__main__": part. So runserver imports this script, try to execute and fail, because django is not imported. So, if you have something like this, be sure that the running function is inside the above if statement, so runserver does not try to run the script when it is imported.
So, if you want to run a script that uses django (and it is not inside the models, views, forms usual stuff), you need to setup django first. You need to find the problematic file and add the following at the top:
import django
sys.path.append("path/to/django/settingsapp")
os.environ["DJANGO_SETTINGS_MODULE"] = "djangochat.settings"
django.setup()
If you find the problematic file and add the above, it will probably fix it.
Hope this helps.
Thank you for all answers, I just moved my project location and set it up again and It works. still, I don't know what was the issue but after moving project directory and environment It is working.
I am trying to set up MySQL, and can't seem to be able to enter the Django manage.py shell interpreter. I did install MySQL-python but that did not solve the issue.
Getting the output below:
rrdhcp-10-32-44-126:django pavelfage$ python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/shell.py", line 45, in handle_noargs
from django.db.models.loading import get_models
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
return import_module('.base', backend_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/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 _mysql
Any suggestions really appreciated.
You are probably missing the MySQLdb module. You basically just have to install it.
By the looks of it, you are using a Mac, so you might want to check out this answer for detailed installation instructions: How to install MySQLdb (Python data access library to MySQL) on Mac OS X?
On a totally alternate solution, as you mentionned Django development you might want to use sqlite3 instead of MySQL, which could be simpler to install.
You should be able to import MySQLdb from python shell.
Try importing MySQLdb from python shell not django
If you can not import MySQLdb from python shell;
It may caused because of 32-64 bit mismatch,
Try this link
I have the following on my MacBook with Osx Lion:
Mysql running with xampp (http://www.apachefriends.org/it/xampp.html)
Django 1.3 running in a virtualenv
I installed Mysql-python with pip install MySQL-python
but when trying to use manage.py syncdb I get the following error:
(django_1.3)Daniel-Mac:fz_biblio daniel$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/commands/syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/utils.py", line 33, in load_backend
return import_module('.base', backend_name)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/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: dlopen(/Users/daniel/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.7-i386.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/daniel/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.7-i386.egg-tmp/_mysql.so: mach-o, but wrong architecture
(django_1.3)Daniel-Mac:fz_biblio daniel$ mate "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py
> "
(django_1.3)Daniel-Mac:fz_biblio daniel$ mate /Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py
Any idea in order to make django work with mysql in my environment?!?!
I finally sorted out the problem installing the right version of MySQL for my machine.
I installed MySQL 64bit version --> Mac OS X ver. 10.6 (x86, 64-bit)
After installing it Everything started working fine. I guess it was due to the fact that my previous installation was a 32bit one, that why mysql-python was complaining for the wrong architecture.
So I just updated django to 1.2.3 and now when I try to run 'python manage.py shell' to work in the django environment, I'm getting the following error.
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/shell.py", line 18, in handle_noargs
loaded_models = get_models()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/loading.py", line 167, in get_models
self._populate()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "/opt/local/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/opt/local/lib/python2.5/site-packages/django_celery-2.0.3-py2.5.egg/djcelery/models.py", line 7, in <module>
from celery import conf
File "/opt/local/lib/python2.5/site-packages/celery-2.0.3-py2.5.egg/celery/conf.py", line 6, in <module>
from celery import routes
File "/opt/local/lib/python2.5/site-packages/celery-2.0.3-py2.5.egg/celery/routes.py", line 2, in <module>
from celery.utils import instantiate, firstmethod, mpromise
File "/opt/local/lib/python2.5/site-packages/celery-2.0.3-py2.5.egg/celery/utils/__init__.py", line 9, in <module>
import importlib
ImportError: No module named importlib
Any ideas. I can't seem to find what's going on here and for all I can tell I'm running the same versions on my web server and I don't have the same error showing up.
importlib which was added in Python 2.7/3.1, I believe. You can download a port for pyton 2.5 here:
importlib 1.0.1 - Backport of importlib.import_module() from Python 2.7
Also check the setup.cfg for celery near the bottom and make sure all the other requirements are met (toward the bottom of the script).
importlib was added to Python in version 3.1, and then backported to Python 2.7. Third party backports are available on PyPI.
Also note that 'backported to 2.7' doesn't imply that all versions after 2.7 will have importlib. Python 3.0, I believe, does not have importlib.