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.91k stars 4.13k forks source link

Not able to the Train the Brain with Reinforcement Learning – Due to the Error: The Communicator was unable to connect. #1286

Closed jayeshBaviskar closed 5 years ago

jayeshBaviskar commented 5 years ago

Not able to the Train the Brain with Reinforcement Learning – Due to the Error: The Communicator was unable to connect.

I have set the Brain Type to External (Ball3DAcademy --> Ball3DBrain --> Brain Type=External)

Selected .NET 4.x Equivalent as a Scripting Runtime Version. Defined ENABLE_TENSORFLOW flag in Scripting Defined Symbols and imported TensorFlowSharp plugin in the project

project settings

I tried mlagents-learn command from the root directory. The command is executing successfully.

mlagents-learn

Then I fired mlagents-learn config\trainer_config.yaml --run-id=firstrun –train command. The command returned

“Start training by pressing the Play button in the Unity Editor.”

So I Pressed Play button of my Unity with 3DBall as a loaded scene.

After Pressing Play Button Unity is displaying the following error Message:

UnityAgentsException: The Communicator was unable to connect. Please make sure the External process is ready to accept communication with Unity. MLAgents.Batcher.SendAcademyParameters (MLAgents.CommunicatorObjects.UnityRLInitializationOutput academyParameters) (at Assets/ML-Agents/Scripts/Batcher.cs:83) MLAgents.Academy.InitializeEnvironment () (at Assets/ML-Agents/Scripts/Academy.cs:320) MLAgents.Academy.Awake () (at Assets/ML-Agents/Scripts/Academy.cs:227)

error

detailed error

I am using Following components: Unity Version: 2018.2.2f1 Visual Studio 2015 with.NET Framework 4.7.1 My C# Project’s csproj File is using 6 as a LangVersion

conda 4.5.11 (Anaconda) with Python 3.6.6

These are the Packages which I have in my Python Environent: _tflow_1100_select 0.0.2 eigen absl-py 0.5.0 py36_0 astor 0.7.1 py36_0 atomicwrites 1.2.1 py36_0 attrs 18.2.0 py36h28b3542_0 backcall 0.1.0 blas 1.0 mkl bleach 1.5.0 py36_0 ca-certificates 2018.03.07 0 certifi 2018.8.24 py36_1 colorama 0.3.9 py36h029ae33_0 cycler 0.10.0 py36h009560c_0 decorator 4.3.0 defusedxml 0.5.0 docopt 0.6.2 py36_0 entrypoints 0.2.3 freetype 2.9.1 ha9979f8_1 gast 0.2.0 py36_0 grpcio 1.11.1 grpcio 1.12.1 py36h1a1b453_0 html5lib 0.9999999 py36_0 icc_rt 2017.0.4 h97af966_0 icu 58.2 ha66f8fd_1 intel-openmp 2019.0 118 ipykernel 5.0.0 ipython 7.0.1 ipython-genutils 0.2.0 ipywidgets 7.4.2 jedi 0.12.1 Jinja2 2.10 jpeg 9b hb83a4c4_2 jsonschema 2.6.0 jupyter 1.0.0 jupyter-client 5.2.3 jupyter-console 5.2.0 jupyter-core 4.4.0 kiwisolver 1.0.1 py36h6538335_0 libpng 1.6.34 h79bbb47_0 libprotobuf 3.6.0 h1a1b453_0 libtiff 4.0.9 h36446d0_2 markdown 2.6.11 py36_0 MarkupSafe 1.0 matplotlib 3.0.0 py36hd159220_0 mistune 0.8.3 mkl 2019.0 118 mkl_fft 1.0.6 py36hdbbee80_0 mkl_random 1.0.1 py36h77b88f5_1 mlagents 0.5.0 more-itertools 4.3.0 py36_0 nbconvert 5.4.0 nbformat 4.4.0 notebook 5.7.0 numpy 1.15.2 py36ha559c80_0 numpy 1.14.5 numpy-base 1.15.2 py36h8128ebf_0 olefile 0.46 py36_0 openssl 1.0.2p hfa6e2cd_0 pandocfilters 1.4.2 parso 0.3.1 pickleshare 0.7.5 pillow 5.2.0 py36h08bbbbd_0 pip 18.0 pip 10.0.1 py36_0 pluggy 0.7.1 py36h28b3542_0 prometheus-client 0.3.1 prompt-toolkit 1.0.15 protobuf 3.6.0 py36he025d50_0 py 1.6.0 py36_0 Pygments 2.2.0 pyparsing 2.2.0 py36_1 pyqt 5.9.2 py36h6538335_2 pytest 3.8.1 py36_0 python 3.6.6 hea74fb7_0 python-dateutil 2.7.3 py36_0 pytz 2018.5 py36_0 pywinpty 0.5.4 pyyaml 3.13 py36hfa6e2cd_0 pyzmq 17.1.2 qt 5.9.6 vc14h1e9a669_2 qtconsole 4.4.1 Send2Trash 1.5.0 setuptools 40.2.0 py36_0 simplegeneric 0.8.1 sip 4.19.8 py36h6538335_0 six 1.11.0 py36_1 sqlite 3.25.2 hfa6e2cd_0 tensorboard 1.7.0 tensorflow 1.7.1 termcolor 1.1.0 py36_1 terminado 0.8.1 testpath 0.4.1 tk 8.6.8 hfa6e2cd_0 tornado 5.1 py36hfa6e2cd_0 traitlets 4.3.2 vc 14.1 h0510ff6_4 vs2015_runtime 14.15.26706 h3a45250_0 wcwidth 0.1.7 werkzeug 0.14.1 py36_0 wheel 0.31.1 py36_0 widgetsnbextension 3.4.2 wincertstore 0.2 py36h7fe50ca_0 yaml 0.1.7 hc54c509_2 zlib 1.2.11 h8395fce_2

xiaomaogy commented 5 years ago

@jayeshBaviskar Have you tried to build the executable, and then provide it the --env to the command line? (refer to this doc https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Learning-Environment-Executable.md)

jayeshBaviskar commented 5 years ago

@xiaomaogy

Yes, I have also tried with the Executable.

2

Used mlagents-learn config\trainer_config.yaml --env=3dgame\3dgame --run-id=first-run --train Command

The above command is Launching the Environment successfully, but after that, it displays the same Error:

issue-1

jayeshBaviskar commented 5 years ago

@xiaomaogy I found the Issue. I had assigned HTTP_PROXY and HTTPS_PROXY values in my Environment variables to install python packages. I removed them and now it is working.

SharangSharma09 commented 5 years ago

@jayeshBaviskar Dear Jayesh, I am exactly in the same situation as you did. How do you remove HTTP_PROXY and HTTPS_PROXY values?

jayeshBaviskar commented 5 years ago

@SharangSharma09
I had those variables in my Environment variables, So I removed them.

SharangSharma09 commented 5 years ago

As I am new to all of this, do you think you can explain to me how to access these environment variables and then debug? I have very limited programming experience

lock[bot] commented 4 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.