Syntax error: can't assign to operator when training with executable

Hi, any idea why I'm getting this syntax error when I try to initiate training on a build from the terminal?

>>> mlagents-learn /config/ppo/Basic.yaml --env=basictest --run-id=firstRun
File "<stdin>", line 1
SyntaxError: can't assign to operator

I am running the command from the root of the project directory (master-ml-agents if you like), which is where all the cloned directories are (ml-agents, ml-agents-envs etc) including the config folder and including the executable, named basictest.x86_64, and the associated data folder.

Before this command I'd ran

from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(file_name='basictest.x86_64')
and that works in terms of producing a pop up window showing the basic environment.

I am on Linux Ubuntu 18.04, Unity 2019.4.4f1. I created a pipenv with Python 3.6, cloned the ML-Agents repo and did pip install -e for ml-agents, ml-agents-envs and gym-unity (all 0.18.0 and tensorflow 2.2.0 was installed as dependency).

I've tried using the full file path to the build from home drive instead of just build name. I've tried 'Basic' instead of 'basictest'. I've looked at the migration document outlining the config format changes and tried the script but it returns an identical yaml file so I think the format I have is up to date. I've tried taking the first line 'behavior:' out of Basic.yaml. Can't figure it out.

mlagents-learn is a console script that gets created when you install the pip package. It looks like you're trying to run it from the python interpreter, which isn't working because that's not valid python code.

mlagents-learn is meant to be run from the command line, but if you really really want to run it from the interpreter, the equivalent to what you're trying to do would be

>>> from mlagents.trainers.learn import run_cli, parse_command_line
>>> run_cli(parse_command_line(["/config/ppo/Basic.yaml", "--env=basictest", "--run-id=firstRun"])

Which is what happens when is run as the main method here.

Also note that you probably want ./config/ppo/Basic.yaml (leading .)


Yep, very obvious now you point it out. Thanks a lot!

Hello @KNRichardson @celion_unity . I did env.reset() it is still stuck on the black screen. Could you please help me knowing how you resolved it ? :)