Celery - No module named five
Asked Answered
U

7

19

After updating celery and django-celery to 3.1:

$ pip freeze | grep celery
celery==3.1.18
django-celery==3.1.16

I run into this error when starting my server:

Traceback (most recent call last):
  File "app/manage.py", line 16, in <module>
    execute_from_command_line(sys.argv)
  [...]
  File "/Users/xxx/.virtualenvs/yyy/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/xxx/.virtualenvs/yyy/lib/python2.7/site-packages/django/conf/__init__.py", line 95, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named five

Using:

  • Django 1.4.21
  • Python 2.7
Unadvised answered 24/9, 2015 at 8:57 Comment(0)
A
47

Last version of vine is 5.0.0 and fresh push was in 06.09.2020 (yesterday) :), and this version do not have any five.py file. So downgrade vine version to.

vine==1.3.0

works for me

UPDATE: by the answer Sarang, amqp and celery now requires vine>=5.0.0

Aranyaka answered 7/9, 2020 at 9:0 Comment(2)
Thank you. My CI pipeline was failing and i was wondering why!Kerikeriann
This isn't an option anymore if you use latest versions (as of May 2022). amqp now needs vine 5.0.0Sibley
U
4

Some suggestions found in internet were:

  • Reinstall both (because of a celery and django-celery version mismatch)

  • Upgrade celery

What worked for me was to upgrade kombu:

pip install kombu -U

NOTE: after updating to celery 3.1, django is supported out of the box.

Unadvised answered 24/9, 2015 at 8:57 Comment(1)
Upvoted; upgrading Kombu is the correct approach now. Kombu removed references to five a while ago. See github.com/celery/kombu/commit/…Pork
W
2

You need to create a celery app according to new celery setup. Create a file celery.py in your project folder with settings.

from __future__ import absolute_import

import os
import sys

from celery import Celery


sfile = 'mysettings_file' # override it
os.environ.setdefault('DJANGO_SETTINGS_MODULE', sfile)


from django.conf import settings

project_name = 'referral' # override it

app = Celery(project_name)
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda : settings.INSTALLED_APPS)

In your app/tasks.py, add your task

from referral import celery_app # substitute your project folder

class MyTask(celery_app.Task):

     pass

Then, use this app to register your tasks. Infact, you don't need djcelery if you want to use celery with django, unless you are using it as database backend.

Whitebeam answered 24/9, 2015 at 9:10 Comment(0)
D
2
  • i face this kind of issue...
from kombu.five import PY3, values
ModuleNotFoundError: No module named 'kombu.five'
  • after that reinstall celery by

  • pip install celery

  • this way i fix this issue in my machine :)

Depew answered 31/8, 2020 at 9:38 Comment(0)
C
1

As of version 5.0.0 celery do not use five or six. It's python 3 only. if you use the latest pypi release, you won't face it. celery 3.1.x and 4.4.x is EOL now.

Cougar answered 7/1, 2022 at 2:48 Comment(0)
S
1

I am on latest (kombu==5.2.4, celery==5.2.6) and still got this error! I thought I will share my experience. I read answers here and tried to downgrade vine to 1.3.0. However, that is not possible as kombu needs amqp latest which needs vine latest!

While I was trying all this, I went back to the latest versions and the error magically disappeared. So not sure what it was, but could be the re-install celery fix that some people have shared here.

But happy to report that the latest (May 2022) combination of kombu==5.2.4, celery==5.2.6, amqp==5.0.9, vine==5.0.0 is working fine!

Sibley answered 7/5, 2022 at 10:36 Comment(0)
H
0

I faced the same issue, it was due to dependency of kombu and vine when we use celery. kombu==5.0.2 and vine==5.0.0 giving issue with celery==4.4.2.

In latest version of vine, vine.five module was not found inside five.py in celery package.

  File "/home/vin/test/lib/python3.6/site-packages/celery/five.py", line 7, in <module>
import vine.five

ModuleNotFoundError: No module named 'vine.five'

Solution: Just reinstall the celery package again it will downgrade vine to 1.3 and kombu to 4.6.11 as per its compatibility.

pip install celery
Henri answered 18/2, 2022 at 8:15 Comment(1)
Not an option anymore if you want to be on latestSibley

© 2022 - 2025 — McMap. All rights reserved.