ray-project / ray

Ray is a unified framework for scaling AI and Python applications. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
33.01k stars 5.59k forks source link

Windows python can not open file default_worker.py path with space #33047

Open MagMueller opened 1 year ago

MagMueller commented 1 year ago

What happened + What you expected to happen

The following error occurred:

(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

I expected tune to run through. I tried this inside and outside a pipenv enviornment and with torch and tensorflow. It could be because my username is Magnus Mueller and it seems like ray does not escape the string correctly.

ppo_config.build().train() without tune works fine.

Versions / Dependencies

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

Reproduction script

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

ppo_config = (PPOConfig().framework("torch").environment("CartPole-v0"))
tuner = tune.Tuner(
        "PPO",
        param_space=ppo_config.to_dict(),
    )
tuner.fit()

Issue Severity

High: It blocks me from completing my task.

MagMueller commented 1 year ago

Same as https://discuss.ray.io/t/ray-unable-to-find-worker-py-due-to-spaces-in-filepath-windows/9591?u=magnus_muller

sven1977 commented 1 year ago

Hey @MagMueller , thanks for filing this issue. I cannot reproduce the error, though, on my own Win machine.

What seems to be suspicious with the error you posted above is the backslash to espace the space character in your directory ...Users\\Magnus\\ Mueller\\.... Maybe it's trying to find the subdirectory " Mueller" under "Magnus"? Maybe try making your Win directories not have spaces in them.

MagMueller commented 1 year ago

@sven1977 The problem is, that the space is in my user path, where i dont have the permissions for changing that.

sven1977 commented 1 year ago

I see. Hmm, could you try pip installing ray inside a say Conda virtual env, where your conda installation is NOT inside this user path? That would fix the problem, I think.

[install conda in c:\\programs\\anaconda]
$ conda create -n ray python=3.9
$ conda activate ray
$ pip install ray[rllib] ...

Something like this. :)

chris-aeviator commented 1 year ago

this happens to me in a conda environment where somehow python assumes ray being intsalled in a folder where it is not, I'm unable to find out the reason for this but will try to solve this taking a bruteforce approach with uninstalling and re creating environments

/home/user/local/lib/python3.7/site-packages/ray/_private/workers/ is really not there

$ which ray /home/user/miniconda3/envs/ray/bin/ray

$ pip3 install ray==2.2.0 Requirement already satisfied: ray==2.2.0 in /home/user/miniconda3/envs/ray/lib/python3.7/site-package