Search Unity

Bug Couldn't connect to trainer on port 5004 using API version 1.5.0. Will perform inference instead.

Discussion in 'ML-Agents' started by spacex_boi, Feb 7, 2023.

  1. spacex_boi

    spacex_boi

    Joined:
    May 26, 2022
    Posts:
    2
    Hey guys, i have been recently trying to setup ML agents.
    After following every step in: https://github.com/Unity-Technologies/ml-agents/blob/develop/docs/Installation.md
    and proceeding to setup i got to a problem where after using mlagents-learn in command prompt and pressing the play button i get:
    upload_2023-2-7_18-29-33.png
    i searched System.IO.IOException: Error loading native library and in: https://github.com/grpc/grpc/issues/21550 i didnt find anything usefull, does anyone have an idea what may have caused this?
    upload_2023-2-7_18-32-23.png upload_2023-2-7_18-33-38.png upload_2023-2-7_18-35-7.png upload_2023-2-7_18-35-38.png
     
  2. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    'error loading native library' means that it's unable to load the mlagents plugin dll.

    You don't need to look into the c# code, or your inspector, since the mlagents plugin dll didnt even load, so won't get as far as looking at those.

    The issue is more likely to revolve around some kind of incompatibility between the plugin dll and your system.

    What kind of system are you running? I'm going to guess it's a Silicon Mac? Which is not to say that mlagents won't work on a silicon mac, cos I have one. I'm going to guess the native library that fails to load is: google protobuf native library. It's often a little precocious...

    The plugins are all in your packages/mlagents folder:

    Screen Shot 2023-02-08 at 04.28.24.png

    You'll want to go through each of these, and ensure they're loading ok.

    If you're on silicon, ... hmmm... weirdly I have a ton of these set to intel x86, which seems odd. But I reckon the one that is likely crashing is grpc native. You should have the following I feel:

    Screen Shot 2023-02-08 at 04.32.40.png
     
  3. spacex_boi

    spacex_boi

    Joined:
    May 26, 2022
    Posts:
    2
    Hey thanks for answering, turns it was probably because my user folder name contained non ascii characters, after renaming it and doing factory restart and doing the whole installation again it works now!
     
    pixelcrac and hughperkins like this.
  4. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
  5. andywater_unity

    andywater_unity

    Joined:
    Jun 20, 2020
    Posts:
    1
    Hello, I'm having the same issue. Do you know what character it was in the directory?
    Thanks.
     
  6. IJM

    IJM

    Joined:
    Aug 31, 2010
    Posts:
    143
    One thing I found, that could help others: ML Training in build won't work if you try to use IL2CPP compiler. So, make sure your project is set to Mono.