M
M
Maxim2017-02-21 17:03:04
Django
Maxim, 2017-02-21 17:03:04

Why does celery write an error referring to python 2.7?

I run it and get this error

Please specify a different user using the -u option.

User information: uid=0 euid=0 gid=0 egid=0

  uid=uid, euid=euid, gid=gid, egid=egid,

 
 -------------- [email protected] v4.0.0 (latentcall)
---- **** ----- 
--- * ***  * -- Linux-4.4.0-34-generic-x86_64-with-Ubuntu-14.04-trusty 2017-02-21 13:50:38
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         backend:0x7fd18c6e6150
- ** ---------- .> transport:   redis://localhost:6379//
- ** ---------- .> results:     redis://localhost:6379/
- *** --- * --- .> concurrency: 1 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery
                

[tasks]


[2017-02-21 13:50:39,888: ERROR/PoolWorker-1] Signal handler <bound method ?.on_worker_process_init of <celery.fixups.django.DjangoWorkerFixup object at 0x7fd18c638790>> raised: ImproperlyConfigured(u'Error loading MySQLdb module: No module named MySQLdb',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/utils/dispatch/signal.py", line 167, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/local/lib/python2.7/dist-packages/celery/fixups/django.py", line 149, in on_worker_process_init
    for c in self._db.connections.all():
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 227, in all
    return [self[alias] for alias in self]
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 212, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 116, in load_backend
    return import_module('%s.base' % backend_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 28, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
[2017-02-21 13:50:40,184: INFO/MainProcess] Connected to redis://localhost:6379//
[2017-02-21 13:50:40,194: INFO/MainProcess] mingle: searching for neighbors
[2017-02-21 13:50:41,587: INFO/MainProcess] mingle: all alone
/usr/local/lib/python2.7/dist-packages/celery/fixups/django.py:202: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warnings.warn('Using settings.DEBUG leads to a memory leak, never '

[2017-02-21 13:50:41,595: WARNING/MainProcess] /usr/local/lib/python2.7/dist-packages/celery/fixups/django.py:202: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warnings.warn('Using settings.DEBUG leads to a memory leak, never '

[2017-02-21 13:50:41,595: INFO/MainProcess] [email protected] ready.

and when I start beat, it generally throws out and writes
Configuration ->
    . broker -> redis://localhost:6379//
    . loader -> celery.loaders.app.AppLoader
    . scheduler -> celery.beat.PersistentScheduler
    . db -> celerybeat-schedule
    . logfile -> [stderr]@%INFO
    . maxinterval -> 5.00 minutes (300s)
[2017-02-21 13:52:39,289: INFO/MainProcess] beat: Starting...
[2017-02-21 13:52:39,392: CRITICAL/MainProcess] beat raised exception <type 'exceptions.ValueError'>: ValueError('unsupported pickle protocol: 3',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/apps/beat.py", line 107, in start_scheduler
    service.start()
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 528, in start
    humanize_seconds(self.scheduler.max_interval))
  File "/usr/local/lib/python2.7/dist-packages/kombu/utils/objects.py", line 44, in __get__
    value = obj.__dict__[self.__name__] = self.__get(obj)
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 572, in scheduler
    return self.get_scheduler()
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 567, in get_scheduler
    lazy=lazy,
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 407, in __init__
    Scheduler.__init__(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 204, in __init__
    self.setup_schedule()
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 435, in setup_schedule
    self._create_schedule()
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 464, in _create_schedule
    self._store[str('entries')]
  File "/usr/lib/python2.7/shelve.py", line 122, in __getitem__
    value = Unpickler(f).load()
ValueError: unsupported pickle protocol: 3
[2017-02-21 13:52:39,394: WARNING/MainProcess] Traceback (most recent call last):
[2017-02-21 13:52:39,394: WARNING/MainProcess] File "/usr/local/bin/celery", line 11, in <module>
[2017-02-21 13:52:39,394: WARNING/MainProcess] sys.exit(main())
[2017-02-21 13:52:39,483: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 14, in main
[2017-02-21 13:52:39,483: WARNING/MainProcess] _main()
[2017-02-21 13:52:39,483: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 326, in main
[2017-02-21 13:52:39,484: WARNING/MainProcess] cmd.execute_from_commandline(argv)
[2017-02-21 13:52:39,484: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 488, in execute_from_commandline
[2017-02-21 13:52:39,484: WARNING/MainProcess] super(CeleryCommand, self).execute_from_commandline(argv)))
[2017-02-21 13:52:39,484: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 278, in execute_from_commandline
[2017-02-21 13:52:39,485: WARNING/MainProcess] return self.handle_argv(self.prog_name, argv[1:])
[2017-02-21 13:52:39,485: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 480, in handle_argv
[2017-02-21 13:52:39,485: WARNING/MainProcess] return self.execute(command, argv)
[2017-02-21 13:52:39,485: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 412, in execute
[2017-02-21 13:52:39,486: WARNING/MainProcess] ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
[2017-02-21 13:52:39,486: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 282, in run_from_argv
[2017-02-21 13:52:39,487: WARNING/MainProcess] sys.argv if argv is None else argv, command)
[2017-02-21 13:52:39,487: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 365, in handle_argv
[2017-02-21 13:52:39,487: WARNING/MainProcess] return self(*args, **options)
[2017-02-21 13:52:39,487: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 241, in __call__
[2017-02-21 13:52:39,487: WARNING/MainProcess] ret = self.run(*args, **kwargs)
[2017-02-21 13:52:39,488: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/bin/beat.py", line 107, in run
[2017-02-21 13:52:39,488: WARNING/MainProcess] return beat().run()
[2017-02-21 13:52:39,488: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/apps/beat.py", line 79, in run
[2017-02-21 13:52:39,488: WARNING/MainProcess] self.start_scheduler()
[2017-02-21 13:52:39,488: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/apps/beat.py", line 107, in start_scheduler
[2017-02-21 13:52:39,489: WARNING/MainProcess] service.start()
[2017-02-21 13:52:39,489: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 528, in start
[2017-02-21 13:52:39,489: WARNING/MainProcess] humanize_seconds(self.scheduler.max_interval))
[2017-02-21 13:52:39,489: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/kombu/utils/objects.py", line 44, in __get__
[2017-02-21 13:52:39,490: WARNING/MainProcess] value = obj.__dict__[self.__name__] = self.__get(obj)
[2017-02-21 13:52:39,490: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 572, in scheduler
[2017-02-21 13:52:39,490: WARNING/MainProcess] return self.get_scheduler()
[2017-02-21 13:52:39,583: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 567, in get_scheduler
[2017-02-21 13:52:39,583: WARNING/MainProcess] lazy=lazy,
[2017-02-21 13:52:39,583: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 407, in __init__
[2017-02-21 13:52:39,583: WARNING/MainProcess] Scheduler.__init__(self, *args, **kwargs)
[2017-02-21 13:52:39,583: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 204, in __init__
[2017-02-21 13:52:39,584: WARNING/MainProcess] self.setup_schedule()
[2017-02-21 13:52:39,584: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 435, in setup_schedule
[2017-02-21 13:52:39,584: WARNING/MainProcess] self._create_schedule()
[2017-02-21 13:52:39,584: WARNING/MainProcess] File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 464, in _create_schedule
[2017-02-21 13:52:39,584: WARNING/MainProcess] self._store[str('entries')]
[2017-02-21 13:52:39,584: WARNING/MainProcess] File "/usr/lib/python2.7/shelve.py", line 122, in __getitem__
[2017-02-21 13:52:39,584: WARNING/MainProcess] value = Unpickler(f).load()
[2017-02-21 13:52:39,585: WARNING/MainProcess] ValueError
[2017-02-21 13:52:39,585: WARNING/MainProcess] :
[2017-02-21 13:52:39,585: WARNING/MainProcess] unsupported pickle protocol: 3

And all this refers to 2.7, although I have 3.4.
Why is that?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2017-02-24
@maximkv25

I found the reason, celery looks at the second python,
we look at the celery settings,
if it is specified
, we actually change it to the third

D
Dmitry, 2017-02-21
@dmtrrr

1) Error loading MySQLdb module - apparently, the library for working with MySQL is not installed
2) unsupported pickle protocol: 3 - see what is set in the celery config
3) look at the version of the python installed in the system, most likely it is 2.7 and it is he who starts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question