Ray unable to find worker.py due to spaces in filepath - Windows

  • High: It blocks me to complete my task.

When calling tune.run() I get the following warning.

(raylet) Path\Python\Python310\python.exe: can’t open file ‘Path with spaces’\venv\lib\site-packages\ray\_private\workers\default_worker.py’: [Errno 2] No such file or directory
(raylet) [2023-03-02 18:30:01,992 E 124388 36360] (raylet.exe) worker_pool.cc:525: Some workers of the worker process(130296) have not registered within the timeout. The process is dead, probably it crashed during start.

It is treating each space as a new folder. I am using Ray 2.3.0 and Pycharm 2022.2.3

Can anyone tell me how to fix this? (if you need more information please let me know)


I face the same issue, every thing worked until now fine

cc: @justinvyu @matthewdeng for thoughts.

@ShawnH91 could you modify the category to “Ray AIR”? This topic is a better fit there.

@Huaiwei_Sun I can’t seem to work out how to change the category, do I just need to recreate it in the right category and then delete this?

This is how I change the category of my post

Reproduction script

from ray import tune
from ray.rllib.algorithms.ppo import PPOConfig

ppo_config = (PPOConfig().framework("torch").environment("CartPole-v0"))
tuner = tune.Tuner(

Windows 11
Python 3.10.9
Gymnasium 0.26.3
ray 2.3.0
torch-scatter torch-sparse torch-geometric -f https://data.pyg.org/whl/torch-1.13.1+cu117.html
torch==1.13.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html


(raylet) C:\Users\Magnus Mueller\AppData\Local\Programs\Python\Python310\python.exe: can't open file 'C:\\Users\\Magnus\\ Mueller\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\ray\\_private\\workers\\default_worker.py': [Errno 2] No such file or directory
1 Like

I don’t have an edit option displaying when I open this topic.

Hey @ShawnH91, can you share what ‘Path with spaces’ is?

Edit: Oh, I see what you mean, it’s the directory that contains env/.

Can you try reproducing this with a simpler script? I think this may be a Ray Core issue.

import ray


def f():
    return 1


Also, could you share the full trace where it fails?

cc @jjyao

1 Like

Hey @Magnus_Muller , could it just be that one of your directories contains a space?
It’s trying to find “…\Magnus\ Mueller…” possibly thinking that " Mueller" is a subdir under “Magnus”. I’m not sure either, but on my Win PC, the repro script (thanks for providing this btw!) works fine.

You are absolutely right.
The problem is, that my username has a space (That’s just possible on Windows), and I do not have the permissions to change that. So maybe we could escape spaces in the path correctly.

I am having the same issue here. The problem is that I have a space in one of the folders in the path. Is there any update on this?

I am having the same issue here. The problem is that I have a space in one of the folders in the path. Is there any update on this?

I could fix this issue by commenting out the following line from ray\_private\runtime_env\context.py

passthrough_args = [s.replace(" “, r”\ ") for s in passthrough_args]

(line 70 for ray 2.6.3)

You can follow my comment