I am trying to get started with ML Agents.
Here’s what I did on my Windows 10 machine in Unity:
-
installed Unity 2019.2
-
cloned GitHub - Unity-Technologies/ml-agents: The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning., branch release-0.13.1
-
opened UnitySDK in Unity and let it run upgrade
-
let Unity update project
-
did NOT find "Scripting Runtime Version" in Project Settings, assumed it is now default
-
went to Assets\ML-Agents\Examples\3DBall\Scenes and double-clicked 3DBall
In Python:
- created new conda environment
- in the environment run .\python.exe -m pip install mlagents “tensorflow==1.*” (successfully)
- launched Python and run (code from the basic example notebook)
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfigurationChannel
from mlagents_envs.environment import UnityEnvironment
channel = EngineConfigurationChannel()
env = UnityEnvironment(base_port=5006, file_name=None, side_channels=[channel])
That printed “INFO:mlagents_envs:Listening on port 5006. Start training by pressing the Play button in the Unity Editor.”
So I hit Play button in the editor, and observed for a few minutes how some built-in agent juggled the balls.
The python, however, never connected. Eventually, I got an error message:
env = UnityEnvironment(base_port=5006, file_name=None, side_channels=[channel])
INFO:mlagents_envs:Listening on port 5006. Start training by pressing the Play button in the Unity Editor.
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\lost.conda\envs\mlagents\lib\site-packages\mlagents_envs\environment.py”, line 125, in init
aca_output = self.send_academy_parameters(rl_init_parameters_in)
File “C:\Users\lost.conda\envs\mlagents\lib\site-packages\mlagents_envs\environment.py”, line 512, in send_academy_parameters
return self.communicator.initialize(inputs)
File “C:\Users\lost.conda\envs\mlagents\lib\site-packages\mlagents_envs\rpc_communicator.py”, line 101, in initialize
self.poll_for_timeout()
File “C:\Users\lost.conda\envs\mlagents\lib\site-packages\mlagents_envs\rpc_communicator.py”, line 94, in poll_for_timeout
“The Unity environment took too long to respond. Make sure that :\n”
mlagents_envs.exception.UnityTimeOutException: The Unity environment took too long to respond. Make sure that :
The environment does not need user interaction to launch
The Agents are linked to the appropriate Brains
The environment and the Python interface have compatible versions.
So the question is: what have I done wrong? I expected Python to connect to Unity and let me type next command line env.reset()