Open
Description
What happened + What you expected to happen
On Windows, install ray>=2.45, and then do
import ray
ray.init()
What Happened
An error:
The last 20 lines of C:\Users\bbm\AppData\Local\Temp\ray\session_2025-06-26_14-25-18_826351_13400\logs\dashboard.log (it contains the error message from the dashboard):
Traceback (most recent call last):
File "C:\Users\bbm\AppData\Local\mambaforge\envs\refl1d312\Lib\site-packages\ray\dashboard\dashboard.py", line 246, in <module>
logging_utils.redirect_stdout_stderr_if_needed(
File "C:\Users\bbm\AppData\Local\mambaforge\envs\refl1d312\Lib\site-packages\ray\_private\logging_utils.py", line 49, in redirect_stdout_stderr_if_needed
sys.stderr = open_log(stderr_fileno, unbuffered=True, closefd=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bbm\AppData\Local\mambaforge\envs\refl1d312\Lib\site-packages\ray\_private\utils.py", line 444, in open_log
stream = open(path, **kwargs)
^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 6] The handle is invalid
What I expected to happen
No error
I tried running ray.init(include_dashboard=False)
but it did not help. It seems to be caused by a Windows-specific error when trying to redirect stdout or stderr, introduced in #51731
Versions / Dependencies
Python 3.12
Ray > 2.44
OS: Windows 11
Reproduction script
import ray
ray.init()
Issue Severity
High: It blocks me from completing my task.