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

mitakuye picture mitakuye  路  7Comments

f0cker picture f0cker  路  4Comments

guhcampos picture guhcampos  路  8Comments

Houd1ny picture Houd1ny  路  4Comments

cw1427 picture cw1427  路  4Comments