Unable to start Redis Queue (RQ) worker in Python
Asked Answered
A

4

8

I installed Python Redis Queue module using pip install rq

When I try to start the worker using rq or rq worker, it is throwing an error.

PYTHONPATH=src REDIS_HOST=localhost rq worker --with-scheduler -u redis://localhost:6379
Traceback (most recent call last):
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\jason.bracket\AppData\Local\Programs\Python\Python37\Scripts\rq.exe\__main__.py", line 4, in <module>
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\site-packages\rq\cli\__init__.py", line 2, in <module>
    from .cli import main
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\site-packages\rq\cli\cli.py", line 93, in <module>
    @pass_cli_config
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\site-packages\rq\cli\cli.py", line 72, in pass_cli_config
    func = option(func)
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\site-packages\click\decorators.py", line 247, in decorator
    _param_memo(f, OptionClass(param_decls, **option_attrs))
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 2467, in __init__
    super().__init__(param_decls, type=type, multiple=multiple, **attrs)
  File "c:\users\jason.bracket\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 2108, in __init__
    ) from None
ValueError: 'default' must be a list when 'multiple' is true.
make: *** [Makefile:50: start-worker-native] Error 1

I am running Python==3.7 and rq==1.7.0 on a Windows 10 machine. How can I start a worker? Do I need to configure anything? Any help would be appreciated.

Aksel answered 14/5, 2021 at 21:50 Comment(2)
always put full error message (starting at word "Traceback") in question (not comment) as text (not screenshot, not link to external portal). There are other useful information.Peacoat
don't hide code in message error .Peacoat
J
13

The problem is the click package. You probably have the 8.0.0 version.

Install click==7.1.2 and it should be OK.

Janeejaneen answered 16/5, 2021 at 5:57 Comment(1)
Thanks. Also github.com/rq/rq/issues/1469 suggests this should be resolved in rq==1.8.1Excerpta
C
0

Use this command to uninstall the version of "click" python module and install the specific version.. but this is the temporary solution.

pip uninstall click && pip install click==7.1.2 

Command support for both Linux and windows

Coinsure answered 22/11, 2021 at 15:35 Comment(0)
S
0

workaround: pin the click to < 8.0.

pip install "click>=7,<8"

Sinistrality answered 12/12, 2022 at 19:33 Comment(0)
S
0

In my case it was not only click but the celery also. However at the time of writing, the following combination works fine -

celery==5.2.7
click==8.1.3
rq==1.8.1
Shanda answered 25/12, 2022 at 7:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.