Ml-agents: Couldn't connect to trainer

Created on 27 Dec 2019  路  3Comments  路  Source: Unity-Technologies/ml-agents

Describe the bug
Hi, I tried to update my version of ml-agents to the most recent one from something pretty old one around 0.7 . So I bumped into a few problems but eventually solved all of them. And created a new project in which I copied the Unity SDK and tried to get used to all the changes... So I started with the 3D Ball example and inference worked just fine but when I tried to do the learning myself inside the unity editor a notification "Couldn't connect to trainer on port 5004 using API version API-12. Will perform inference instead." showed and instead of the learning process, it started inference from the default model. So the learning process ended with a timeout error. I checked the python version inside my "ml-agents\ml-agents-envs\mlagentsenvsenvironment.py" and it sais API is 12 and then I checked the API in Academy script in my project and it sais API 12 as well. I only noticed that unity mentions 5004 port while the command line mentions 5005 but don't know what it really means. I have also installed Baracuda(0.3.2) through package manager in unity and I am using Unity 2018.3.6f1.

To Reproduce
I am not sure I believe I just updated to the newest version and created an empty project and imported unity SDK

Console logs / stack traces
Whole message in unity
Couldn't connect to trainer on port 5004 using API version API-12. Will perform inference instead. UnityEngine.Debug:Log(Object) MLAgents.Academy:InitializeEnvironment() (at Assets/ML-Agents/Scripts/Academy.cs:319) MLAgents.Academy:LazyInitialization() (at Assets/ML-Agents/Scripts/Academy.cs:238) MLAgents.Agent:OnEnable() (at Assets/ML-Agents/Scripts/Agent.cs:255)

Screenshots
timeout error
error0
error1

Environment (please complete the following information):

  • Windows 10
  • _ML-Agents version_: latest release branch from source)
  • _TensorFlow version_: 1.7.1
  • _Environment_: 3DBall

I have just probably messed something during the update but I searched the forums and docs and found that some other guys have pretty similar problems but their threads were never solved.

PS: first time posting anything so if you need any more info let me know

bug

Most helpful comment

Have you tried creating a new virtual environment and following the installation instructions for development?

cd ml-agents-envs
pip3 install -e ./
cd ..
cd ml-agents
pip3 install -e ./

I had a lot of trouble getting ml-agents up and running without a virtual environment.

All 3 comments

So I tried to update Unity to the newest version but it did not help either. Then I tried to play around with Academy script a bit and I changed the port there to 5005 as the command line said but nothing except the number in the Unity notification changed.

Have you tried creating a new virtual environment and following the installation instructions for development?

cd ml-agents-envs
pip3 install -e ./
cd ..
cd ml-agents
pip3 install -e ./

I had a lot of trouble getting ml-agents up and running without a virtual environment.

Thank you @afewvowels you probably saved my bachelor thesis. I don't know how it happened but after running the development installation it suggested to me to upgrade the pip and now everything works even without the virtual environment... Thank you once more...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlindmark picture dlindmark  路  3Comments

jlanis picture jlanis  路  4Comments

Porigon45 picture Porigon45  路  3Comments

mattinjersey picture mattinjersey  路  3Comments

GeriBP picture GeriBP  路  3Comments