I'm new to celery and python in general and wanted to use celery to have an async task in the application. While I tried to see how it works, a demo app itself was not working on my local setup. I started rabbitmq server locally on the system with default config: user: guest, password: guest and on default port 5672.
I picked the sample code from http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html
from celery import Celery
app = Celery('tasks', broker='amqp://guest:guest@localhost:5672/hello')
@app.task
def add(x, y):
return x + y
All these were done and are placed inside of a virtualenv. Then I am in the folder location containing the app.py file and use the command: celery -A tasks worker --loglevel=info to run the celery worker from the terminal. Getting following output after executing the command:
Traceback (most recent call last):
File "/usr/local/bin/celery", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/celery/__main__.py", line 13, in main
from celery.bin.celery import main as _main
File "/Library/Python/2.7/site-packages/celery/bin/__init__.py", line 2, in <module>
from .base import Option
File "/Library/Python/2.7/site-packages/celery/bin/base.py", line 17, in <module>
from celery import VERSION_BANNER, Celery, maybe_patch_concurrency
File "/Library/Python/2.7/site-packages/celery/local.py", line 509, in __getattr__
module = __import__(self._object_origins[name], None, None, [name])
File "/Library/Python/2.7/site-packages/celery/app/__init__.py", line 5, in <module>
from celery import _state
File "/Library/Python/2.7/site-packages/celery/_state.py", line 15, in <module>
from celery.utils.threads import LocalStack
File "/Library/Python/2.7/site-packages/celery/utils/__init__.py", line 9, in <module>
from .functional import memoize # noqa
File "/Library/Python/2.7/site-packages/celery/utils/functional.py", line 11, in <module>
from kombu.utils.functional import (
ImportError: cannot import name LRUCache
Dependencies used: amqp 2.2.2, billiard 3.5.0.3, celery 4.1.0, kombu 4.1.0, python 3.6
Let me know the mistake and if any other details required