Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question mlagents-learn showing the following error

Discussion in 'ML-Agents' started by dhanushkhersas, Dec 22, 2022.

  1. dhanushkhersas


    Apr 27, 2022
    (This is my first post on the forums)

    I am working in the unity ver. 2022.3.16f and am working on mlagents. I followed the entire code monkey tutorial and installed python3.7.9, ml agents 0.29 and I installed pytorch ver.1.7.1. then I ran mlagents-learn --help and the following message came at the last:

    Torch Configuration:
    --torch-device DEVICE
    Settings for the default torch.device used in
    training, for example, "cpu", "cuda", or "cuda:0"
    (default: None)

    And then I ran: mlagents-learn --run-id=test7

    The following errors came:

    Traceback (most recent call last):
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\", line 193, in _run_module_as_main
    "__main__", mod_spec)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\", line 85, in _run_code
    exec(code, run_globals)
    File "C:\Users\Admin\My project (1)\mlvenv\Scripts\mlagents-learn.exe\", line 7, in <module>
    File "c:\users\admin\my project (1)\mlvenv\lib\site-packages\mlagents\trainers\", line 260, in main
    File "c:\users\admin\my project (1)\mlvenv\lib\site-packages\mlagents\trainers\", line 256, in run_cli
    run_training(run_seed, options, num_areas)
    File "c:\users\admin\my project (1)\mlvenv\lib\site-packages\mlagents\trainers\", line 89, in run_training
    stats_writers = register_stats_writer_plugins(options)
    File "c:\users\admin\my project (1)\mlvenv\lib\site-packages\mlagents\plugins\", line 47, in register_stats_writer_plugins
    if ML_AGENTS_STATS_WRITER not in importlib_metadata.entry_points():
    File "c:\users\admin\my project (1)\mlvenv\lib\site-packages\importlib_metadata\", line 261, in __eq__
    return self._key() == other._key()
    AttributeError: 'str' object has no attribute '_key'

    I don't know what this means.
  2. hughperkins


    Dec 3, 2022
    Without knowing what is in your front-end, it's hard to say, but I would personally recommend upgrading all your version:
    - python => upgrade to python 3.10, eg 3.10.16 is the latest
    - - personally I use pyenv to install python, it's super convenient I find
    - ml-agents => git clone the ml-agents github repo, do `git checkout release_20`, and install from that
    - then see if the problem still persists. Maybe it was fixed in the later version. But if it wasn't, at least you'll be on the latest version, and more people will have the same version as you, and can look up the exact filepath and line numbers you are providing
  3. dhanushkhersas


    Apr 27, 2022
    Thanks for your reply! It worked. I just had an old python version!
    Last edited: Dec 29, 2022
    GamerLordMat and hughperkins like this.
  4. Maxawa


    May 12, 2022
    for me it just gives an error saying numpy failed to build or something