Celery 4.2-Django RecursionError: maximum recursion depth exceeded

recursionerror: maximum recursion depth exceeded while calling a python object
unable to load celery application
celery python

My __init__.py file

from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app

__all__ = ('celery_app',)

My celery.py file

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
app = Celery('myproject')

app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

my /etc/supervisor/conf.d/celery.conf file:

[program:]
command=/home/user/venv/bin/celery -A myproject worker --loglevel=INFO
environment=PYTHONPATH=/home/user/project-folder
user=user
numprocs=1
autostart=true
autorestart=true
stdout_logfile=/home/user/logs/celery.log
stderr_logfile=/home/user/logs/celery.log
startssecs=10
stopwaitsecs = 600
stopasgroup=true
priority=100

and this is the last section of the error message in celery.log

File "/home/user/venv/lib/python3.6/site-packages/celery/loaders/base.py", line 131, in config_from_object
   self._conf = force_mapping(obj)
File "/home/user/venv/lib/python3.6/site-packages/celery/utils/collections.py", line 48, in force_mapping
   return DictAttribute(m) if not isinstance(m, Mapping) else m
File "/home/user/venv/lib/python3.6/abc.py", line 183, in __instancecheck__
   subclass = instance.__class__
File "/home/user/venv/lib/python3.6/site- packages/django/utils/functional.py", line 215, in inner
   self._setup()
File "/home/user/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
   self._wrapped = Settings(settings_module)
File "/home/user/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
   mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/user/venv/lib/python3.6/importlib/__init__.py", line 126, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 894, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
File "<frozen importlib._bootstrap_external>", line 1129, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1273, in find_spec
File "<frozen importlib._bootstrap_external>", line 1231, in _get_spec
File "<frozen importlib._bootstrap_external>", line 556, in 
spec_from_file_location
RecursionError: maximum recursion depth exceeded

I don't know whats wrong with this configuration?


You shouldn't be importing your celery app in your __init__.py file. Take that out and it will fix your infinite startup import loop. Essentially, your celery app kicks off the django settings module initialization which in turn loads the apps and tries to reload the project __init__.py file which loads your celery file, which then tries to reload the settings file because it hasn't initialized which in turn . . . (you get the idea).

celery integration RecursionError · Issue #265 · getsentry/sentry , amqp==2.3.2 billiard==3.5.0.5 celery==4.2.1 Django==2.1.7 In Sentry there are "maximum recursion depth exceeded" errors but no useful  Hi, when I call celery apply_async function, sometimes it raise Exception like this. It seems like getting config failed. This bug can&#39;t always reappear. I guess celery may be not init correctl


I also have the same problem, when I delete the sentence

app.autodiscover_tasks()

then it works. So I think the problem is happend because of that. Maybe we should specify the config of this function.

Maximum recursion depth exceeded while calling a Python object , Hi, when I call celery apply_async function, sometimes it raise Exception like this. It seems like getting config failed. This bug can't always  HonzaKral changed the title problems with celery, maximum recursion depth exceeded problems with celery, maximum recursion depth exceeded (DocType cannot be unpickled) Apr 24, 2015 HonzaKral closed this in 803bc25 Apr 24, 2015


In case it helps someone - I had a similar problem and it was caused by an exception in the overridden on_configure method of Celery class. I guess anything that prevents Celery._load_config method from executing normally might cause the "maximum recursion depth exceeded" error.

django: Celery 4.2-Django RecursionError: maximum recursion , _bootstrap_external>", line 556, in spec_from_file_location RecursionError: maximum recursion depth exceeded. I don't know whats wrong  Maximum recursion depth exceeded while calling a maximum recursion depth exceeded exceptions.RuntimeError: maximum recursion depth exceeded while calling a


python - Error Execution Celery - Django - CentOS, Python = 3.6.5 Django = 2.0.6 Kombu = 4.2.1 celery = 4.2.0 _bootstrap>", line 968, in _find_and_load RecursionError: maximum recursion depth exceeded. I am working from the cookiecutter Flask template, which uses the application factory pattern. I had Celery working for tasks that did not use the application context, but one of my tasks does nee


RecursionError at form maximum recursion depth exceeded while , RecursionError at form maximum recursion depth exceeded while calling a Celery is a great tool which can help your Django project to do background tasks. [2019-02-07 14:42:04,505: INFO/ForkPoolWorker-6] starting chain of 73 chords with 5 tasks, for 365 reports [2019-02-07 14:42:55,328: INFO/MainProcess] missed heartbeat from celery@default [2019-02-07 14:43:10,998: INFO/MainProcess] missed heartbeat from celery@default [2019-02-07 14:43:33,982: WARNING/MainProcess] Substantial drift from celery


supervisord - St4k, Celery 4.2-Django RecursionError: maximum recursion depth exceeded. django​celerysupervisord. Aug 10 '18 19:27. Ronny Alfonso. 25. 7. votes. 1. answer. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more First 25 Users Free