Python Celery RabbitMQ PicklingError

Category : Code ยท by Jul 30th, 2012

I was getting an error setting up Celery running RabbitMQ as my AMQP in Django. Every time I called a tasks’s delay() method, I got the following error:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/worker/", line 371, in process_task
File "/usr/local/lib/python2.7/dist-packages/celery/worker/", line 191, in execute_using_pool
File "/usr/local/lib/python2.7/dist-packages/celery/concurrency/", line 135, in apply_async
File "/usr/local/lib/python2.7/dist-packages/billiard/", line 1135, in apply_async
self._quick_put((result._job, None, func, args, kwds))
PicklingError: Can't pickle : attribute lookup __builtin__.instancemethod failed

Frustrated and without a solution from google, I resigned to a synchronous solution in the meantime. A few days later, I approached the problem again.

On a whim, I checked what version of django-celery I was using:
python -c "import djcelery; print djcelery.__version__"

Turns out I was using 3.0.1. After digging around the changelog for celery, I found the error was solved with celery 3.0.3.

A pip update solved the problem for me:
pip install -U django-celery

tl;dr upgrade celery past 3.0.3


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>