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.

ML-Agents won't start training

Discussion in 'ML-Agents' started by ilaydanil, May 17, 2020.

  1. ilaydanil

    ilaydanil

    Joined:
    May 17, 2020
    Posts:
    20
    I try to start the training by running

    mlagents-learn config/trainer_config.yaml --run-id=firstRun --train

    Yet the Anaconda Prompt gives me this error:

    Traceback (most recent call last):
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
    ImportError: DLL load failed: The specified module could not be found
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\Scripts\mlagents-learn-script.py", line 11, in <module>
    load_entry_point('mlagents', 'console_scripts', 'mlagents-learn')()
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\pkg_resources\__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\pkg_resources\__init__.py", line 2862, in load_entry_point
    return ep.load()
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\pkg_resources\__init__.py", line 2453, in load
    return self.resolve()
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\pkg_resources\__init__.py", line 2459, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
    File "c:\users\user\desktop\ml-agents-15.0-capstone\ml-agents-release_1\ml-agents\mlagents\trainers\learn.py", line 12, in <module>
    from mlagents import tf_utils
    File "c:\users\user\desktop\ml-agents-15.0-capstone\ml-agents-release_1\ml-agents\mlagents\tf_utils\__init__.py", line 1, in <module>
    from mlagents.tf_utils.tf import tf as tf # noqa
    File "c:\users\user\desktop\ml-agents-15.0-capstone\ml-agents-release_1\ml-agents\mlagents\tf_utils\tf.py", line 3, in <module>
    import tensorflow as tf # noqa I201
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module>
    from tensorflow.python import pywrap_tensorflow
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module>
    raise ImportError(msg)
    ImportError: Traceback (most recent call last):
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
    File "C:\Users\user\anaconda3\envs\mlagentsrelease1\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
    ImportError: DLL load failed: The specified module could not be found
    Failed to load the native TensorFlow runtime.
    See https://www.tensorflow.org/install/errors
    for some common reasons and solutions. Include the entire stack trace
    above this error message when asking for help.
     
  2. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    79
    Hello!

    What version of Python did you install?

    I'm on Windows and with Python 3.8 I couldn't install mlagents package completely (missing native package for Tensorflow dependency). I had to install Python 3.7.7.

    PS: Are you sure about --train flag? It's not listed by the binary when using --help :confused:
     
  3. ilaydanil

    ilaydanil

    Joined:
    May 17, 2020
    Posts:
    20
    I have solved the problem. The reason it gave this error was the version of the TensorFlow. When I downgraded TensorFlow to 2.0.0, it didn't give any errors. Also it doesn't work well with Python 3.8. I had to install 3.7.7.
     
  4. ilaydanil

    ilaydanil

    Joined:
    May 17, 2020
    Posts:
    20
    Also I had to activate the ml agents environment to start the training.
     
  5. celion_unity

    celion_unity

    Unity Technologies

    Joined:
    Jun 12, 2019
    Posts:
    289