Hi, I wanted to try something new and found this tutorial (
).
So i followed it until the step where you run the command “mlagents-learn”. Until there everything worked just like in the tutorial.
Here I am getting this big error :
I have tried “pip install protobuf==3.20” and “pip3 install --upgrade protobuf==3.20.0” and “pip install importlib-metadata==4.8” but i always get the same errors, sometimes even a bit more. Also i installed Latest supported Visual C++ Redistributable downloads | Microsoft Learn but that didnt help either.
I am using unity 2021.3.14f1 and Python 3.7.9. The torch version should be 1.7.1.
Thanks for any help!!
I’m currently having the same issue. One thing to note is you have to type “mlagents-learn --force” to overwrite the existing data; even though it failed to train before. I assume, like me, once you do this you’ll continue to get a traceback error.
I also installed visual studio redistributables 2015-2022.
I was initially following the same tutorial but have turned to a multitude of other sources to try and get it fixed. I’ve gotten close but still run into errors. I’ve tried the whole process from scratch on Python 3.7, 3.8, and 3.9.
I saw some recommendations to downgrade importlib-metadata (type “pip install importlib-metadata==4.8”) to version 4.4 or 4.8; supposedly this is because the ml agents package doesn’t work with the newer versions of importlib. Version 4.4 wasn’t available but 4.8 was and it got me past the error the OP is having and onto a new one.
The first image below is what I managed to get after downgrading the importlib. Before I was having the same issue as the OP (after using “mlagents-learn --force”). The second image is the error that occurred when I play the editor.
The code below is what I have my agent set up for and the Debug.Log logs only 0s. The third image below shows the inspector’s view of the agent for reference.
using Unity.MLAgents;
using Unity.MLAgents.Actuators;
using UnityEngine;
public class MoveToGoalAgent : Agent
{
[SerializeField]
private float MoveSpeed = 5f;
[SerializeField]
private Transform GoalTransform;
public override void OnActionReceived(ActionBuffers actions)
{
Debug.Log(actions.DiscreteActions[0]);
}
}
Turns out the issue I had after downgrading the importlib was just an error in my AI setup; I had set observations to 0. tobias-htl-wo You should try running the command “pip install importlib-metadata==4.8”. I did this in the virtual environment after installing everything including ml agents and it took me from getting your type of errors to not getting errors. I’m using the same version of everything else as you. Hope it helps you.