[Solution Found] Using Ray's debugger on Windows

How severe does this issue affect your experience of using Ray?

  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.

Problem Description:

I use the Windows system. According to the tutorial, after I added breakpoint() in my code, I typed ray debug in my terminal and then selected the corresponding breakpoint’s index (for instance “0”). Then, I will get an error with the message:

  File "D:\Anaconda\envs\XXXX\lib\site-packages\ray\util\rpdb.py", line 346, in _connect_pdb_client
    read_sockets, write_sockets, error_sockets = select.select(
OSError: [WinError 10038] An operation was attempted on something that is not a socket


According to a hint I got from this answer, I found how to fix it:

You should change the _connect_pdb_client(host, port) function at line 340 in ray.util.rpdb.py to:

def _connect_pdb_client(host, port):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host, port))
    import msvcrt

    while True:
        # Get the list of sockets which are readable.
        ready_to_read = select.select([s], [], [], 1)[0]  # Added code
        if msvcrt.kbhit(): ready_to_read.append(sys.stdin)  # Added code

        # for sock in read_sockets:
        for sock in ready_to_read:  # Changed code
            if sock == s:
                # Incoming message from remote debugger.
                data = sock.recv(4096)
                if not data:
                # User entered a message.
                msg = sys.stdin.readline()

I think maybe the support of using Debugger on the Windows system can be added. Or maybe “without modifying the source code, the Debugger only supports Linux systems” can be mentioned in the documentation.

Just a small piece of advice. Thank you for your development of this fantastic project.

Best regards,


1 Like

thx. filed an issue: [Observability / Doc] Add support of ray debugger on windows · Issue #44902 · ray-project/ray · GitHub

1 Like

Thank you for your attention to this matter.

Thanks both - let’s follow up on GH > brought up in discussion with mattip@ on the repo as well. Stay tuned; we’ll probably have Mattip working on a fix…