Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Error running mlagents-learn -h

Discussion in 'ML-Agents' started by dreamingforgestudio, Mar 14, 2024.

  1. dreamingforgestudio

    dreamingforgestudio

    Joined:
    Mar 7, 2024
    Posts:
    7
    Getting error after running python venv venv
    Run activate

    Code (CSharp):
    1. (venv) C:\Users\Thomas_Yiu\Spacecraft\venv\Scripts>mlagents-learn
    2. Traceback (most recent call last):
    3.   File "<frozen runpy>", line 198, in _run_module_as_main
    4.   File "<frozen runpy>", line 88, in _run_code
    5.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Scripts\mlagents-learn.exe\__main__.py", line 4, in <module>
    6.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents\trainers\learn.py", line 2, in <module>
    7.     from mlagents import torch_utils
    8.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents\torch_utils\__init__.py", line 1, in <module>
    9.     from mlagents.torch_utils.torch import torch as torch  # noqa
    10.     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    11.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents\torch_utils\torch.py", line 6, in <module>
    12.     from mlagents.trainers.settings import TorchSettings
    13.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents\trainers\settings.py", line 25, in <module>
    14.     from mlagents.trainers.cli_utils import StoreConfigFile, DetectDefault, parser
    15.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents\trainers\cli_utils.py", line 5, in <module>
    16.     from mlagents_envs.environment import UnityEnvironment
    17.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents_envs\environment.py", line 12, in <module>
    18.     from mlagents_envs.side_channel.side_channel import SideChannel
    19.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents_envs\side_channel\__init__.py", line 5, in <modul
    20. e>
    21.     from mlagents_envs.side_channel.default_training_analytics_side_channel import (  # noqa
    22.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents_envs\side_channel\default_training_analytics_side
    23. _channel.py", line 7, in <module>
    24.     from mlagents_envs.communicator_objects.training_analytics_pb2 import (
    25.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\mlagents_envs\communicator_objects\training_analytics_pb2.
    26. py", line 35, in <module>
    27.     _descriptor.FieldDescriptor(
    28.   File "C:\Users\Thomas_Yiu\Spacecraft\venv\Lib\site-packages\google\protobuf\descriptor.py", line 621, in __new__
    29.     _message.Message._CheckCalledFromGeneratedFile()
    30. TypeError: Descriptors cannot be created directly.
    31. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
    32.  
    33. If you cannot immediately regenerate your protos, some other possible workarounds are:
    34. 1. Downgrade the protobuf package to 3.20.x or lower.
    35. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
    36.  
    37. More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

    More details:
    Python 3.12.1

    mlagent info:
    0.28.0
    How can I resolve it?
     
  2. dreamingforgestudio

    dreamingforgestudio

    Joined:
    Mar 7, 2024
    Posts:
    7
    I got it fixed. I installed anaconda, and install python 3.10.13 and changed mlagent setup.py to 3.10.13 and mlagent-env setup to 3.10.13. I github the mlagent and install the mlagent using python -m pip install ./ml-agents-envs, python -m pip install ./ml-agents

    it is running now