django-haystack / django-haystack/celery-haystack
Celery 5.2.7: Error importing module celery_haystack.tasks: "No module named 'celery.task'"
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 226
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
Apparently newer versions of Celery dropped the task module.
Error from a test project:
>>> t = Ticket.objects.latest()
>>> t.description = 'test123'
>>> t.save()
Traceback (most recent call last):
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/celery_haystack/utils.py", line 17, in get_update_task
mod = import_module(module)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/celery_haystack/tasks.py", line 11, in <module>
from celery.task import Task # noqa
ModuleNotFoundError: No module named 'celery.task'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/tank/code/testproject/support/models.py", line 285, in save
super().save(*args, **kwargs)
File "/tank/code/testproject/support/models.py", line 64, in save
super(BaseModel, self).save(*args, **kwargs)
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/django/db/models/base.py", line 814, in save
self.save_base(
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/django/db/models/base.py", line 892, in save_base
post_save.send(
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send
return [
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/celery_haystack/signals.py", line 21, in enqueue_save
return self.enqueue('update', instance, sender, **kwargs)
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/celery_haystack/signals.py", line 44, in enqueue
enqueue_task(action, instance)
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/celery_haystack/utils.py", line 41, in enqueue_task
task = get_update_task()
File "/home/aaron/.virtualenvs/testproject/lib/python3.10/site-packages/celery_haystack/utils.py", line 19, in get_update_task
raise ImproperlyConfigured('Error importing module %s: "%s"' %
django.core.exceptions.ImproperlyConfigured: Error importing module celery_haystack.tasks: "No module named 'celery.task'"
>>>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with celery_haystack/tasks.py at the import shown in the traceback, then inspect utils.py and get_update_task. Reproduce the failure with Celery 5.2.7 by saving a model and verify that the task module imports and the save no longer raises ImproperlyConfigured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100