Worker_process_setup_hook causes exception due to spaces in path


I’m experiencing an exception when I specifiy a worker_process_setup_hook in the runtime environment of ray.init. When I simply execute the demo code from the ray documentation, tasks fail apprently due to spaces in the path.

import ray
import logging
import warnings

def logging_setup_func():
    logger = logging.getLogger("ray")

ray.init(runtime_env={"worker_process_setup_hook": logging_setup_func})


def f(x):
    return x * x

futures = [f.remote(i) for i in range(4)]
print(ray.get(futures)) # [0, 1, 4, 9]

Assuming python is located in “C:\folder with spaces\python.exe”, this generates the exception:

(raylet) C:\folder with spaces\python.exe: can't open file 'C:\\folder\\with\\spaces\\Lib\\site-packages\\ray\\_private\\workers\\': [Errno 2] No such file or directory

So apparently the spaces in directory “folder with spaces” are considered as subfolders.
I’m running ray 2.7.1 with Python 3.11.4 on Windows 10.

Any ideas?


Hmm is other runtime env API working? E.g., env_Vars?

Sadly, no. env_vars gives me the same error.