ModuleNotFoundError: No module named 'kombu.asynchronous.timer'解決
阿新 • • 發佈:2020-08-11
報錯:
(env) D:\python_learn\meiduo_project\meiduo_mall>celery -A celery_tasks.main worker -l info Traceback (most recent call last): File "D:\Python\Python38\lib\runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python\Python38\lib\runpy.py", line 86, in_run_code exec(code, run_globals) File "D:\python_learn\meiduo_project\env\Scripts\celery.exe\__main__.py", line 7, in <module> File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\__main__.py", line 16, in main _main() File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 322, in main cmd.execute_from_commandline(argv) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 484, in execute_from_commandline super(CeleryCommand, self).execute_from_commandline(argv))) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\base.py", line 275, in execute_from_commandline return self.handle_argv(self.prog_name, argv[1:]) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 476, in handle_argv return self.execute(command, argv) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 404, in execute return cls( File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\worker.py", line 223, in run_from_argv return self(*args, **options) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\base.py", line 238, in __call__ ret = self.run(*args, **kwargs) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\worker.py", line 252, in run worker = self.app.Worker( File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\worker\worker.py", line 101, in __init__ self.setup_instance(**self.prepare_args(**kwargs)) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\worker\worker.py", line 132, in setup_instance self.pool_cls = _concurrency.get_implementation(self.pool_cls) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\concurrency\__init__.py", line 23, in get_implementation return symbol_by_name(cls, ALIASES) File "d:\python_learn\meiduo_project\env\kombu\utils\imports.py", line 56, in symbol_by_name module = imp(module_name, package=package, **kwargs) File "D:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\concurrency\prefork.py", line 18, in <module> from celery.concurrency.base import BasePool File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\concurrency\base.py", line 15, in <module> from celery.utils import timer2 File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\utils\timer2.py", line 16, in <module> from kombu.asynchronous.timer import Entry ModuleNotFoundError: No module named 'kombu.asynchronous.timer'
搜尋到說解決方法是回退版本,
pip uninstall celery && pip install celery==3.1.25
但是回退後又報錯
(env) D:\python_learn\meiduo_project\meiduo_mall>celery -A celery_tasks.main worker -l info Traceback (most recent call last): File "D:\Python\Python38\lib\runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python\Python38\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "D:\python_learn\meiduo_project\env\Scripts\celery.exe\__main__.py", line 7, in <module> File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\__main__.py", line 30, in main main() File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 81, in main cmd.execute_from_commandline(argv) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 793, in execute_from_commandline super(CeleryCommand, self).execute_from_commandline(argv))) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\base.py", line 311, in execute_from_commandline return self.handle_argv(self.prog_name, argv[1:]) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 785, in handle_argv return self.execute(command, argv) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\celery.py", line 713, in execute return cls( File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\worker.py", line 179, in run_from_argv return self(*args, **options) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\base.py", line 274, in __call__ ret = self.run(*args, **kwargs) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\bin\worker.py", line 194, in run pool_cls = (concurrency.get_implementation(pool_cls) or File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\concurrency\__init__.py", line 29, in get_implementation return symbol_by_name(cls, ALIASES) File "d:\python_learn\meiduo_project\env\lib\site-packages\kombu\utils\__init__.py", line 96, in symbol_by_name module = imp(module_name, package=package, **kwargs) File "D:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\concurrency\prefork.py", line 20, in <module> from celery.concurrency.base import BasePool File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\concurrency\base.py", line 21, in <module> from celery.utils import timer2 File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\utils\timer2.py", line 19 from kombu.async.timer import Entry, Timer as Schedule, to_timestamp, logger ^ SyntaxError: invalid syntax
然後再次升級到最新版本,不再出現報錯:
pip install celery