Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

StrictVersion has no attribute 'version'

Discussion in 'ML-Agents' started by mmmbop, Apr 14, 2022.

  1. mmmbop


    Jan 22, 2022
    Hello , im trying to start training, but got this error in console and "Couldnt connect to trainer using API version 1.5.0" Unity Console.

    At first it connected, but after 2 minutes worker is restarting and raise error

    Version information:
    ml-agents: 0.28.0,
    ml-agents-envs: 0.28.0,
    Communicator API: 1.5.0,
    PyTorch: 1.7.1+cu110

    [INFO] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.
    [INFO] Connected to Unity environment with package version 2.0.1 and communication version 1.5.0
    [INFO] Connected new brain: Walker?team=0

    ===Hyperparameters ====

    Code (CSharp):
    1. [WARNING] Restarting worker[0] after 'The Unity environment took too long to respond. Make sure that :
    2.         The environment does not need user interaction to launch
    3.         The Agents' Behavior Parameters > Behavior Type is set to "Default"
    4.          The environment and the Python interface have compatible versions.
    5.          If you're running on a headless server without graphics support, turn off display by either passing --no-graphics option or build your Unity executable as server build.'
    6. [INFO] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.
    7. [ERROR] UnityEnvironment worker 0: environment raised an unexpected exception.
    8. Traceback (most recent call last):
    9.   File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\", line 163, in worker
    10.     env = env_factory(worker_id, side_channels)
    11.   File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\", line 192, in create_unity_environment
    12.     log_folder=log_folder,
    13.   File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents_envs\", line 245, in __init__
    14.     aca_params.package_version,
    15.   File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents_envs\", line 96, in _check_communication_compatibility
    16.     if unity_communicator_version.version[0] == 0:
    17. AttributeError: 'StrictVersion' object has no attribute 'version'
    18. [INFO] Exported results\legs\Walker\Walker-0.onnx
    19. [INFO] Copied results\legs\Walker\Walker-0.onnx to results\legs\Walker.onnx.
    20. Traceback (most recent call last):
    21.   === Another long traceback ===
    22. File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\", line 446, in _reset_env
    23.     ew.previous_step = EnvironmentStep(ew.recv().payload, ew.worker_id, {}, {})
    24.   File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\", line 101, in recv
    25.     raise env_exception
    26. AttributeError: 'StrictVersion' object has no attribute 'version'
  2. fabhiansan


    Feb 26, 2022
    I'm having the same trouble
  3. WalterCoding


    Feb 9, 2021
    same problem here
  4. Ch1ckenNug


    Sep 14, 2021
    Has anybody found a fix?
  5. Cichy_93


    Jul 7, 2015
    I had the same problem when I was following "MLAgents: Hummingbirds" tutorial. After launching the learning process, the Agents were moving but after some time, Unity froze and got the errors.

    This solution worked for me:

    "go to Edit -> Project Settings -> Player, and tick "Run In Background""

    After that, I no longer have freezes and errors. Anaconda Prompt also started to print the learning progress (as it should):
    [INFO] Hummingbird. Step: 10000. Time Elapsed: 53.456 s. Mean Reward: -2.375. Std of Reward: 5.566. Training.
    Vellyxenya likes this.