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.
https://unity.com/products/machine-learning-agents
Other
16.93k stars 4.14k forks source link

The Communicator was unable to connect. Please make sure the External process is ready to accept communication with Unity. at MLAgents.Batcher.SendAcademyParameters #2880

Closed bharathk005 closed 4 years ago

bharathk005 commented 4 years ago

I am trying to use the ml-agents python api to train an agent in the unity environment. I was using OpenAI gym and sometimes I use box2D to create the environment which was very time consuming. I found ml-agents to be a better option. Basically I am just trying to train one of the examples first before I create my environment. But I am not sure why I keep getting this error. " The Communicator was unable to connect. Please make sure the External process is ready to accept communication with Unity. at MLAgents.Batcher.SendAcademyParameters"

I can share the complete log file but I believe this must be a common issue. I am new to Unity so not sure what is really missing.

I followed this tutorial: https://alaurans.com/blog/building-a-unity-environment-for-training-an-agent-with-python

surfnerd commented 4 years ago

Hi @bharathk005, Please make sure that both your python package and UnitySDK are from the same 0.11 release. You can run pip list to see what version of the ML-Agents python package is installed.

The definition of the gRPC service changed between 0.10 and 0.11 and is not backwards compatible.

bharathk005 commented 4 years ago

@surfnerd , thanks for the quick response. ml-agents version is 0.11 python 3.6.1 conda 4.6.14 tried with Unity 2017.4.34f1 and 2018.4.12f1 but no luck it is a windows system.

bharathk005 commented 4 years ago

@surfnerd also when I cloned the ml-agents again, I dont see the Brain scripts under the Scripts folder. Also not able to add new brain scripts to the project.

tlalexander commented 4 years ago

I am also affected by this issue. I did not intentionally update but I did see that I had both 0.10 and 0.11 on my system. I believe I have fixed that so I only have 0.11 installed, but now the broadcasthub seems to be gone from my academy. Is there a tutorial for migrating from 0.10 to 0.11 or a changelist somewhere?

In my case everything had been working, so I was really stumped when I first got this issue.

tlalexander commented 4 years ago

Hey there actually is a guide! https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Migrating.md Going through that now...

tlalexander commented 4 years ago

Well that guide worked for me. I can train again. I must say these error messages were painfully unhelpful. It took me the whole afternoon to figure out what happened. The first error I got was a timeout from the python side, then I noticed the "unable to connect" error in Unity. And I had not consciously updated. It would be nice for future versions to better detect this situation and clearly notify the user.

tlalexander commented 4 years ago

I just realized the mismatch may have occurred when I installed gym_unity. The problem occurred after I had executed "pip3 install gym_unity" and perhaps it pulled in version 0.11 of MLAgents when I had been using 0.10 successfully before. I did not expect installing gym_unity to change versions, though I understand now why it did, but the total lack of a useful error message in this case really was problematic for me.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had activity in the last 14 days. It will be closed in the next 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed because it has not had activity in the last 28 days. If this issue is still valid, please ping a maintainer. Thank you for your contributions.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.