Rq: Error 'module' object has no attribute 'fork' under Windows 10

Created on 18 Jul 2017  路  3Comments  路  Source: rq/rq

I am trying to using rq under windows 10, but get an error in worker:

 File "c:\dev\src\rq\rq\worker.py", line 474, in work
    self.execute_job(job, queue)
  File "c:\dev\src\rq\rq\worker.py", line 592, in execute_job
    self.fork_work_horse(job, queue)
  File "c:\dev\src\rq\rq\worker.py", line 534, in fork_work_horse
    child_pid = os.fork()
AttributeError: 'module' object has no attribute 'fork'

Most helpful comment

Windows Linux Subsystem supports FORK!!!

The way to get this working, is:

  1. You will need the Windows Linux Subsystem. as of not not widely released: https://docs.microsoft.com/en-us/windows/wsl/install-win10
  2. Then you go to the Microsoft Store and install a linux distro and run it.. (this actually does the install)
  3. In your command prompt (or vs code terminal) you can then run bash and from there you can pip install rq and then run the worker.

In my case, I am running redis in a container at localhost:32768
So in following the samples they change so that you setup your connection and yoru worker like this:

  • q = Queue(connection=Redis(host="localhost", port="32768"))
  • rq worker --url redis://localhost:32768

See also Issue #937

All 3 comments

Dcoumentation excerpt:

Limitations
RQ workers will only run on systems that implement fork(). Most notably, this means it is not possible to run the workers on Windows.

Windows Linux Subsystem supports FORK!!!

The way to get this working, is:

  1. You will need the Windows Linux Subsystem. as of not not widely released: https://docs.microsoft.com/en-us/windows/wsl/install-win10
  2. Then you go to the Microsoft Store and install a linux distro and run it.. (this actually does the install)
  3. In your command prompt (or vs code terminal) you can then run bash and from there you can pip install rq and then run the worker.

In my case, I am running redis in a container at localhost:32768
So in following the samples they change so that you setup your connection and yoru worker like this:

  • q = Queue(connection=Redis(host="localhost", port="32768"))
  • rq worker --url redis://localhost:32768

See also Issue #937

os.fork() only works with Linux operating systems, and with Win10 you can use the cross-platform multiprocessing module

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jkryanchou picture jkryanchou  路  7Comments

jtfidje picture jtfidje  路  5Comments

sivabudh picture sivabudh  路  4Comments

willvousden picture willvousden  路  7Comments

mitakuye picture mitakuye  路  7Comments