ksiomelo
ksiomelo

Reputation: 1908

Can't import Celery modules

I have a weird problem, I successful installed celery, but I can't import its modules:

>>> import celery   # OK

>>> import djcelery

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/django_celery-2.5.5-py2.7.egg/djcelery/__init__.py", line    25, in <module>
from celery import current_app as celery  # noqa
ImportError: cannot import name current_app

>>> from celery.decorators import task

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named decorators

this error occurs on celery 2.6.0a3 (from github) or 2.5.3 (from pypi) and django-celery 2.5.5. Tried re-installing several times, and even tried in Jython and I got the same error.

I have no clue what it is, can anyone help me out?

Upvotes: 5

Views: 6026

Answers (2)

Eli Alb&#233;rt
Eli Alb&#233;rt

Reputation: 706

honestly, there is a better answer, which I wrote about here.

It's gotta do with a mismatch between your system python (and particularly, with the python standard lib "os") and your precompiled virtualenv python binary.

Deactivating virtualenv, deleting your virtualenv python binary, and then running the virtualenv script on the same virtualenv folder will recompile python for your virtualenv and fix the issue.

Upvotes: 4

ksiomelo
ksiomelo

Reputation: 1908

well cloned the project (celery) from github, and a python setup.py install resolved. Weird that it couldn't import its modules when installed via pip in my machine (even when /Library/Python/2.7/site-packages/celery/decorators.py task was there).

Hope it helps someone.

Upvotes: -1

Related Questions