Search Unity

'mlagents-learn' is not recognized as an internal or external command, operable program or batch fil

Discussion in 'ML-Agents' started by Ninetails1410, Jun 11, 2020.

  1. Ninetails1410

    Ninetails1410

    Joined:
    Sep 27, 2013
    Posts:
    2
    I have created a ml environment on windows and I am trying to train my agent but I get
    Code (CSharp):
    1. 'mlagents-learn' is not recognized as an internal or external command, operable program or batch file.
    when I try to run mlagents-learn with my config file and a run id specified as parameters. I added the path to ml-agents/trainers/learn.py into my PATH environment variable and I followed the instructions for setting up a virtual environment but I get the same results. When I run learn.py from within the trainers directory with command
    Code (CSharp):
    1. learn.py config\Platformer.yaml --run-id=Platformer
    I get a console window but it closes very quickly and before closing for a split second it says that it's missing the parameter trainer_config_path even though as you can see I certainly specified it. Switching the order of the parameters as well as specifying the full path to my config yaml file doesn't help. I'm sure I'm doing something simple wrong but I can't figure it out. I'm using 64 bit windows.
    Can anyone help me? Thanks!
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    I'll flag this with the team, and pass along any guidance they have.
     
  3. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    Try using Anaconda. I don't know why they don't recommend it, as it's pretty much the standard for Python on Windows. After installation open an Anaconda Prompt and run these:
    • conda create -n mlagents python=3.7
    • activate mlagents
    • pip install mlagents
    That's all you need to do to get it working. After that you can run the mlagents-learn command in that environment.
     
    vincentgao88 likes this.
  4. vincentgao88

    vincentgao88

    Unity Technologies

    Joined:
    Feb 7, 2018
    Posts:
    21
    We used to have a doc that used Anaconda, but later on we tried to unify the installation workflow across Mac, Linux and Windows, so we decided to remove it.
     
  5. punkouter2020

    punkouter2020

    Joined:
    Oct 28, 2019
    Posts:
    3
    This works.. But why do they have a way to do this without anaconda? I keep trying this new way and without anaconda I can't get mlagents-learn to work as well.. so confusing..
     
  6. aginart

    aginart

    Joined:
    May 1, 2020
    Posts:
    1
    I installed the latest version of Python for Windows 3.8.4 and realised that the pip command did not fully work. Downgraded to Python 3.7 and it all worked fine. I suspect there are version specific commands in some of the scripts along the way.
     
  7. Seydjinn

    Seydjinn

    Joined:
    Nov 3, 2020
    Posts:
    3
    Thank you very much guys ! I had the same issue (I downloaded python 3.9 -_-'), I installed Anaconda as you said and so far it's working. \o/ thanks !
     
    TreyK-47 likes this.