StrictVersion has no attribute 'version'

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 ====

[WARNING] Restarting worker[0] after 'The Unity environment took too long to respond. Make sure that :
         The environment does not need user interaction to launch
         The Agents' Behavior Parameters > Behavior Type is set to "Default"
         The environment and the Python interface have compatible versions.
         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.'
[INFO] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.
[ERROR] UnityEnvironment worker 0: environment raised an unexpected exception.
Traceback (most recent call last):
  File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\subprocess_env_manager.py", line 163, in worker
    env = env_factory(worker_id, side_channels)
  File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\learn.py", line 192, in create_unity_environment
    log_folder=log_folder,
  File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents_envs\environment.py", line 245, in __init__
    aca_params.package_version,
  File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents_envs\environment.py", line 96, in _check_communication_compatibility
    if unity_communicator_version.version[0] == 0:
AttributeError: 'StrictVersion' object has no attribute 'version'
[INFO] Exported results\legs\Walker\Walker-0.onnx
[INFO] Copied results\legs\Walker\Walker-0.onnx to results\legs\Walker.onnx.
Traceback (most recent call last):
  === Another long traceback ===
File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\subprocess_env_manager.py", line 446, in _reset_env
    ew.previous_step = EnvironmentStep(ew.recv().payload, ew.worker_id, {}, {})
  File "C:\Users\Antigr\python-envs\sample-env\lib\site-packages\mlagents\trainers\subprocess_env_manager.py", line 101, in recv
    raise env_exception
AttributeError: 'StrictVersion' object has no attribute 'version'
3 Likes

I'm having the same trouble

same problem here

Has anybody found a fix?

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:
https://forum.unity.com/threads/warning-restarting-worker-0-after-the-unity-environment-took-too-long-to-respond.1292478/#post-8335542

"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.

1 Like