Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to start Redis Queue (RQ) worker in Python

Tags:

python

redis

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.

like image 775
Jason Bracket Avatar asked May 14 '21 21:05

Jason Bracket


People also ask

What is Python RQ?

RQ: Simple job queues for Python. RQ (Redis Queue) is a simple Python library for queueing jobs and processing them in the background with workers. It is backed by Redis and it is designed to have a low barrier to entry. It can be integrated in your web stack easily.

What is Python worker class?

RQ: Workers. A worker is a Python process that typically runs in the background and exists solely as a work horse to perform lengthy or blocking tasks that you don't want to perform inside web processes.


Video Answer


1 Answers

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

Install click==7.1.2 and it should be OK.

like image 51
RaS Avatar answered Sep 19 '22 21:09

RaS