15
votes

I'm trying to follow the install tutorial for Django-celery. After installing, I need to run migrate to make the necessary tables, but this error appears:

Traceback (most recent call last):

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

execute_from_command_line(sys.argv)

File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/management/__init__.py",

line 353, in execute_from_command_line

utility.execute()

File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/management/__init__.py",

line 327, in execute

django.setup()

File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/__init__.py",

line 18, in setup

apps.populate(settings.INSTALLED_APPS)

File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/apps/registry.py",

line 108, in populate

app_config.import_models(all_models)

File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/apps/config.py",

line 202, in import_models

self.models_module = import_module(models_module_name)

File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module

__import__(name)

File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/djcelery/models.py",

line 15, in <module>

from celery.utils.timeutils import timedelta_seconds

ImportError: No module named timeutils

I'm not finding anything about this "timeutils" on the Internet... I'm using Django 1.9.8 and Django-celery 3.1.17.

Please help!

3
Maybe this is this package: pypi.python.org/pypi/cs.timeutils ?Marcin
See this issue: github.com/celery/django-celery/issues/491. If you are using celery 4.0 this is likely the issue, as django-celery does not support this version.elethan
right, im using celery 4.0... im confused, so i cant use django-celery? When i install the pip package django-celery by default install celery 4.0 How i say to pip install django-celery set a previous version of celery? In this case, what i do? tks @elethanGuilherme Ribeiro de Souza
@GuilhermeRibeirodeSouza my impression is that you must downgrade to an older version of celery if you want to use django-celery, but I am not 100% sure as I have never used celery.elethan
@elethan, yes i think the same, but downgrade to an older version of celery looks like a hard work because i not finding anything how to downgrade the package of celery.Guilherme Ribeiro de Souza

3 Answers

34
votes

It appears that django-celery==3.1.17 does not work with newer versions of celery (see this github issue).

If it is acceptable to you to use an earlier version of celery, you can uninstall your current version, install a specific older version, and django-celery should work again. For example:

$ pip uninstall celery
$ pip install celery==3.1

should get things working again until django-celery supports a newer version of celery.

2
votes

For Django==1.9.8

$ pip install django-celery==3.1.17
$ pip uninstall celery
$ pip install celery==3.1.25
0
votes

a bit late, but this helped me, pip3 did the trick for me, I needed the latest version of django-celery for my project so I put this in my requirements.txt file (at the time of writing this the latest version was django-celery==3.3.1)

celery==
croniter==
django-celery==3.3.1
django-celery-beat==
kombu==

and then run the command

pip3 install -r requirements.txt

which automatically checked for the dependency of the various packages and installed all other packages, I then run pip freeze and got

celery==3.1.26.post2
croniter==1.0.15
django-celery==3.3.1
django-celery-beat==2.0.0
kombu==3.0.37