[RLlib] Windows CLI, cmd.exe, powershell parsing json arguments JSONDecodeError
What happened + What you expected to happen
Following the installation on the Getting started page. Starting with a clean python 3.8.16 anaconda environment on Windows 10 running in cmd.exe, following these steps:
pip install "ray[rllib]" tensorflow
rllib train --algo DQN --env CartPole-v1 --stop '{"training_iteration": 30}'
After solving some issues mentioned in #35491 I receive:
No such command "30}'".
When running the command through powershell, the error is:
JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
When removing --stop '{"training_iteration": 30}' from the arguments, the training starts. Following the same steps on a Windows 11 system causes the same issue. Following the same steps in WSL works without issue.
Versions / Dependencies
Tested on Windows 10, Windows 11 Using cmd.exe, powershell Python=3.8
Reproduction script
Starting with a clean python 3.8.16 anaconda environment on Windows 10 running in cmd.exe, following the steps from the Getting started page + hotfix for missing dependency:
pip install "ray[rllib]" tensorflow tensorflow-probabilities
rllib train --algo DQN --env CartPole-v1 --stop '{"training_iteration": 30}'
Issue Severity
None
Try escaping the \"; so '{\"training_iteration\": 30}'
Thanks, this trick worked in powershell, so running:
rllib train --algo DQN --env CartPole-v1 --stop '{\"training_iteration\": 30}' --framework tf2
is running for me on windows.
It did not work for cmd, but I found a different workaround (which does not work for powershell). Using " outside and "" inside seems to pass them correctly to the code:
rllib train --algo DQN --env CartPole-v1 --stop "{""training_iteration"": 30}" --framework tf2
The issue is resolved for me, and I guess this can not really be fixed through code, so maybe some form of documentation can be added to guide windows users?
This P2 issue has seen no activity in the past 2 years. It will be closed in 2 weeks as part of ongoing cleanup efforts.
Please comment and remove the pending-cleanup label if you believe this issue should remain open.
Thanks for contributing to Ray!