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
17.12k stars 4.15k forks source link

Cannot run Environement from Inside Spyder (UnityTimeOut) #5676

Closed Phoenix-surgere closed 2 years ago

Phoenix-surgere commented 2 years ago

Describe the bug After quite a lot of hardship getting the built to complete, I've come across the "UnityTimeOutException" error while trying to create a custom environment with anaconda and spyder. I thought I was up-to-date with the versions but apparently, that is not the case and I do not understand what I should do to solve the issue.

Isn't the latest version of ml-agents, release 18, supposed to work with python version 3.7.11, or am I missing something? I am not sure how to ensure all these things from the Releases page in the GitHub match up, I just downloaded the latest version and got some example code following a tutorial to work (3d ball one) and thought it would also work if called from inside Spyder.

What exactly should I do? Does the screenshot I send just say to downgrade ml agents to an earlier version? Because I already have the latest. I also have Unity 2020.3.25f1 and going by the changelog [2.1.0-exp.1] for com.unity.ml_agents, which is in fact the recommended version

    "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' Behavior Parameters > Behavior Type is set to "Default"
         The environment and the Python interface have compatible versions.

Screenshots version_issue

error_spyder

Environment (please complete the following information):

I mainly do not understand what more I am supposed to do after having downloaded the latest version, particularly since when running the vanilla PPO/SAC algorithms from the terminal works alright.

kkalera commented 2 years ago

When you open the example environment, make sure that the right behavior type is selected for the agent. You can find this under the behavior parameters script like the error suggests. This is probably causing your issue

Screenshot 2022-01-17 115845

Phoenix-surgere commented 2 years ago

Hi,

No, unfortunately, that is not it since I took care in specifying the correct behavior type and then double-checked to ensure I did not mess that easy one up. I actually took a screenshot of the incompatibility issue which I still cannot understand, the one I linked in my post above, though by downgrading the ML-Agents to 0.20 seemed to do the trick, which also seems strange

kkalera commented 2 years ago

If you open the package manager in unity, does it also say you have version 2.1.0-exp.1 ? This is the com.unity.ml-agents package that is compatible with v0.27.0 according to https://github.com/Unity-Technologies/ml-agents/releases

Personally I am using the following versions without any issues using anaconda for a python environment: Unity package: 2.0.1 (Release version listed in the package manager) Python package: 0.26.0 Python version: 3.8.12 OS: Windows 11

stale[bot] commented 2 years ago

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

stale[bot] commented 2 years ago

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

github-actions[bot] commented 2 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.