ImportError: no module named dateutil

I am trying to follow the example in the document “First Steps with Celery”. I installed celery using pip.

I created a file called tasks.py in ~ / python / celery and it contains the following:

from celery import Celery celery = Celery('tasks', broker='amqp:// guest@localhost //') @celery.task def add(x, y): return x + y 

I started using celery -A tasks worker -loglevel = info in the ~ / python / celery directory and it seems to work.

In a separate terminal window, I started Python and did the following:

 from tasks import add add.delay(4, 4) 

I get an error: File "/Library/Python/2.7/site-packages/celery/utils/timeutils.py", line 17, in from dateutil import tz ImportError: there is no module named dateutil

How to install dateutils? It is listed as an installed module when I type "pip freeze"

Thanks!

+4
source share
1 answer

This is strange since you say you see it as installed with pip .

I just launched pip freeze | grep date pip freeze | grep date and this is what I get:

 python-dateutil==1.5 

Is your answer something similar? By running the following:

 $ python >>> import dateutil >>> help(dateutil) 

I was told that my dateutil module dateutil installed in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.py (OS X). I would check your Python installation to make sure nothing worked. You do not need to install it separately, but you can probably use pip to remove it and then reinstall

+3
source

Source: https://habr.com/ru/post/1482004/


All Articles