У меня установлены библиотеки redis и celery python.У меня установлен и работает сервер redis.используя bash, я могу запустить python
и import redis
без ошибок.У меня установлен python-celery-common.Я использую PyCharm и WSL.По какой-то причине, когда я создаю tasks.py и пытаюсь запустить celery -A tasks worker --loglevel=info
в bash, я получаю следующую трассировку стека (обратите внимание на python3 на пути к сельдерею, когда я запускаю python 2.7 - у меня такое ощущение, что это важно, но не уверенкак или как изменить):
Traceback (most recent call last):
File "/usr/bin/celery", line 26, in <module>
load_entry_point("celery", "console_scripts", "celery")()
File "/usr/lib/python3/dist-packages/celery/__main__.py", line 14, in main
_main()
File "/usr/lib/python3/dist-packages/celery/bin/celery.py", line 326, in main
cmd.execute_from_commandline(argv)
File "/usr/lib/python3/dist-packages/celery/bin/celery.py", line 488, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/lib/python3/dist-packages/celery/bin/base.py", line 281, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/usr/lib/python3/dist-packages/celery/bin/celery.py", line 480, in handle_argv
return self.execute(command, argv)
File "/usr/lib/python3/dist-packages/celery/bin/celery.py", line 412, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/usr/lib/python3/dist-packages/celery/bin/worker.py", line 221, in run_from_argv
return self(*args, **options)
File "/usr/lib/python3/dist-packages/celery/bin/base.py", line 244, in __call__
ret = self.run(*args, **kwargs)
File "/usr/lib/python3/dist-packages/celery/bin/worker.py", line 255, in run
**kwargs)
File "/usr/lib/python3/dist-packages/celery/worker/worker.py", line 99, in __init__
self.setup_instance(**self.prepare_args(**kwargs))
File "/usr/lib/python3/dist-packages/celery/worker/worker.py", line 122, in setup_instance
self.should_use_eventloop() if use_eventloop is None
File "/usr/lib/python3/dist-packages/celery/worker/worker.py", line 241, in should_use_eventloop
self._conninfo.transport.implements.async and
File "/usr/lib/python3/dist-packages/kombu/connection.py", line 832, in transport
self._transport = self.create_transport()
File "/usr/lib/python3/dist-packages/kombu/connection.py", line 576, in create_transport
return self.get_transport_cls()(client=self)
File "/usr/lib/python3/dist-packages/kombu/transport/redis.py", line 1009, in __init__
raise ImportError('Missing redis library (pip install redis)')
ImportError: Missing redis library (pip install redis)
вывод из bash при запуске python
:
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
вывод из pip freeze
amqp==2.3.2
asn1crypto==0.24.0
billiard==3.5.0.5
celery==4.2.1
cryptography==2.1.4
Django==1.11.11
djangorestframework==3.9.0
enum34==1.1.6
idna==2.6
ipaddress==1.0.17
keyring==10.6.0
keyrings.alt==3.0
kombu==4.2.2
psycopg2==2.7.4
pycrypto==2.6.1
pygobject==3.26.1
pytz==2018.7
pyxdg==0.25
redis==3.0.1
SecretStorage==2.3.1
six==1.11.0
sqlparse==0.2.4
vine==1.1.4