mlagents-learn 배치파일이 아닙니다 에러 해결

2022. 3. 10. 10:01UnityMLAgent/오류 해결

C:\WINDOWS\system32>pip install mlagents==0.28.0
Collecting mlagents==0.28.0
  Downloading mlagents-0.28.0-py3-none-any.whl (164 kB)
     ---------------------------------------- 164.6/164.6 KB ? eta 0:00:00
Collecting grpcio>=1.11.0
  Using cached grpcio-1.44.0-cp37-cp37m-win_amd64.whl (3.4 MB)
Collecting cattrs<1.1.0
  Downloading cattrs-1.0.0-py2.py3-none-any.whl (14 kB)
Collecting protobuf>=3.6
  Downloading protobuf-3.19.4-cp37-cp37m-win_amd64.whl (896 kB)
     ---------------------------------------- 896.4/896.4 KB 28.6 MB/s eta 0:00:00
Collecting importlib-metadata
  Downloading importlib_metadata-4.11.2-py3-none-any.whl (17 kB)
Collecting h5py>=2.9.0
  Using cached h5py-3.6.0-cp37-cp37m-win_amd64.whl (2.8 MB)
Collecting tensorboard>=1.15
  Downloading tensorboard-2.8.0-py3-none-any.whl (5.8 MB)
     ---------------------------------------- 5.8/5.8 MB 46.1 MB/s eta 0:00:00
Collecting attrs>=19.3.0
  Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
     ---------------------------------------- 60.6/60.6 KB ? eta 0:00:00
Collecting pypiwin32==223
  Downloading pypiwin32-223-py3-none-any.whl (1.7 kB)
Requirement already satisfied: numpy<2.0,>=1.13.3 in c:\python_3_7_9\lib\site-packages (from mlagents==0.28.0) (1.21.5)
Collecting Pillow>=4.2.1
  Downloading Pillow-9.0.1-cp37-cp37m-win_amd64.whl (3.2 MB)
     ---------------------------------------- 3.2/3.2 MB 41.4 MB/s eta 0:00:00
Collecting mlagents-envs==0.28.0
  Downloading mlagents_envs-0.28.0-py3-none-any.whl (77 kB)
     ---------------------------------------- 77.4/77.4 KB ? eta 0:00:00
Collecting pyyaml>=3.1.0
  Downloading PyYAML-6.0-cp37-cp37m-win_amd64.whl (153 kB)
     ---------------------------------------- 153.2/153.2 KB 9.5 MB/s eta 0:00:00
Collecting cloudpickle
  Downloading cloudpickle-2.0.0-py3-none-any.whl (25 kB)
Collecting pywin32>=223
  Downloading pywin32-303-cp37-cp37m-win_amd64.whl (9.2 MB)
     ---------------------------------------- 9.2/9.2 MB 42.4 MB/s eta 0:00:00
Collecting six>=1.5.2
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting cached-property
  Downloading cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781 kB)
     ---------------------------------------- 781.3/781.3 KB 24.9 MB/s eta 0:00:00
Requirement already satisfied: setuptools>=41.0.0 in c:\python_3_7_9\lib\site-packages (from tensorboard>=1.15->mlagents==0.28.0) (47.1.0)
Collecting werkzeug>=0.11.15
  Downloading Werkzeug-2.0.3-py3-none-any.whl (289 kB)
     ---------------------------------------- 289.2/289.2 KB 17.4 MB/s eta 0:00:00
Collecting tensorboard-data-server<0.7.0,>=0.6.0
  Downloading tensorboard_data_server-0.6.1-py3-none-any.whl (2.4 kB)
Collecting requests<3,>=2.21.0
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
     ---------------------------------------- 63.1/63.1 KB ? eta 0:00:00
Collecting wheel>=0.26
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting markdown>=2.6.8
  Downloading Markdown-3.3.6-py3-none-any.whl (97 kB)
     ---------------------------------------- 97.8/97.8 KB 5.5 MB/s eta 0:00:00
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
Collecting absl-py>=0.4
  Downloading absl_py-1.0.0-py3-none-any.whl (126 kB)
     ---------------------------------------- 126.7/126.7 KB ? eta 0:00:00
Collecting google-auth<3,>=1.6.3
  Downloading google_auth-2.6.0-py2.py3-none-any.whl (156 kB)
     ---------------------------------------- 156.3/156.3 KB ? eta 0:00:00
Requirement already satisfied: typing-extensions>=3.6.4 in c:\python_3_7_9\lib\site-packages (from importlib-metadata->mlagents==0.28.0) (4.1.1)
Collecting zipp>=0.5
  Downloading zipp-3.7.0-py3-none-any.whl (5.3 kB)
Collecting cachetools<6.0,>=2.0.0
  Downloading cachetools-5.0.0-py3-none-any.whl (9.1 kB)
Collecting pyasn1-modules>=0.2.1
  Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     ---------------------------------------- 155.3/155.3 KB ? eta 0:00:00
Collecting rsa<5,>=3.1.4
  Downloading rsa-4.8-py3-none-any.whl (39 kB)
Collecting requests-oauthlib>=0.7.0
  Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.3-py3-none-any.whl (61 kB)
     ---------------------------------------- 61.2/61.2 KB 3.2 MB/s eta 0:00:00
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.8-py2.py3-none-any.whl (138 kB)
     ---------------------------------------- 138.7/138.7 KB 8.6 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
     ---------------------------------------- 149.2/149.2 KB ? eta 0:00:00
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     ---------------------------------------- 77.1/77.1 KB ? eta 0:00:00
Collecting oauthlib>=3.0.0
  Downloading oauthlib-3.2.0-py3-none-any.whl (151 kB)
     ---------------------------------------- 151.5/151.5 KB ? eta 0:00:00
Installing collected packages: tensorboard-plugin-wit, pywin32, pyasn1, certifi, cached-property, zipp, wheel, werkzeug, urllib3, tensorboard-data-server, six, rsa, pyyaml, pypiwin32, pyasn1-modules, protobuf, Pillow, oauthlib, idna, h5py, cloudpickle, charset-normalizer, cachetools, attrs, requests, importlib-metadata, grpcio, google-auth, cattrs, absl-py, requests-oauthlib, mlagents-envs, markdown, google-auth-oauthlib, tensorboard, mlagents
Successfully installed Pillow-9.0.1 absl-py-1.0.0 attrs-21.4.0 cached-property-1.5.2 cachetools-5.0.0 cattrs-1.0.0 certifi-2021.10.8 charset-normalizer-2.0.12 cloudpickle-2.0.0 google-auth-2.6.0 google-auth-oauthlib-0.4.6 grpcio-1.44.0 h5py-3.6.0 idna-3.3 importlib-metadata-4.11.2 markdown-3.3.6 mlagents-0.28.0 mlagents-envs-0.28.0 oauthlib-3.2.0 protobuf-3.19.4 pyasn1-0.4.8 pyasn1-modules-0.2.8 pypiwin32-223 pywin32-303 pyyaml-6.0 requests-2.27.1 requests-oauthlib-1.3.1 rsa-4.8 six-1.16.0 tensorboard-2.8.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 urllib3-1.26.8 werkzeug-2.0.3 wheel-0.37.1 zipp-3.7.0

C:\WINDOWS\system32>pip list
Package                 Version
----------------------- -----------
absl-py                 1.0.0
attrs                   21.4.0
cached-property         1.5.2
cachetools              5.0.0
cattrs                  1.0.0
certifi                 2021.10.8
charset-normalizer      2.0.12
cloudpickle             2.0.0
google-auth             2.6.0
google-auth-oauthlib    0.4.6
grpcio                  1.44.0
h5py                    3.6.0
idna                    3.3
importlib-metadata      4.11.2
Markdown                3.3.6
mlagents                0.28.0
mlagents-envs           0.28.0
numpy                   1.21.5
oauthlib                3.2.0
Pillow                  9.0.1
pip                     22.0.4
protobuf                3.19.4
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pypiwin32               223
pywin32                 303
PyYAML                  6.0
requests                2.27.1
requests-oauthlib       1.3.1
rsa                     4.8
setuptools              47.1.0
six                     1.16.0
tensorboard             2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.1
torch                   1.7.1+cu110
typing_extensions       4.1.1
urllib3                 1.26.8
Werkzeug                2.0.3
wheel                   0.37.1
zipp                    3.7.0

C:\WINDOWS\system32>mlagents -learn
'mlagents'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.

C:\WINDOWS\system32>mlagents --learn
'mlagents'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.

C:\WINDOWS\system32>mlagents -learn --help
'mlagents'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.

C:\WINDOWS\system32>mlagents-learn --help
usage: mlagents-learn.exe [-h] [--env ENV_PATH] [--resume] [--deterministic]
                          [--force] [--run-id RUN_ID]
                          [--initialize-from RUN_ID] [--seed SEED]
                          [--inference] [--base-port BASE_PORT]
                          [--num-envs NUM_ENVS] [--num-areas NUM_AREAS]
                          [--debug] [--env-args ...]
                          [--max-lifetime-restarts MAX_LIFETIME_RESTARTS]
                          [--restarts-rate-limit-n RESTARTS_RATE_LIMIT_N]
                          [--restarts-rate-limit-period-s RESTARTS_RATE_LIMIT_PERIOD_S]
                          [--torch] [--tensorflow] [--results-dir RESULTS_DIR]
                          [--width WIDTH] [--height HEIGHT]
                          [--quality-level QUALITY_LEVEL]
                          [--time-scale TIME_SCALE]
                          [--target-frame-rate TARGET_FRAME_RATE]
                          [--capture-frame-rate CAPTURE_FRAME_RATE]
                          [--no-graphics] [--torch-device DEVICE]
                          [trainer_config_path]

positional arguments:
  trainer_config_path

optional arguments:
  -h, --help            show this help message and exit
  --env ENV_PATH        Path to the Unity executable to train (default: None)
  --resume              Whether to resume training from a checkpoint. Specify
                        a --run-id to use this option. If set, the training
                        code loads an already trained model to initialize the
                        neural network before resuming training. This option
                        is only valid when the models exist, and have the same
                        behavior names as the current agents in your scene.
                        (default: False)
  --deterministic       Whether to select actions deterministically in policy.
                        `dist.mean` for continuous action space, and
                        `dist.argmax` for deterministic action space (default:
                        False)
  --force               Whether to force-overwrite this run-id's existing
                        summary and model data. (Without this flag, attempting
                        to train a model with a run-id that has been used
                        before will throw an error. (default: False)
  --run-id RUN_ID       The identifier for the training run. This identifier
                        is used to name the subdirectories in which the
                        trained model and summary statistics are saved as well
                        as the saved model itself. If you use TensorBoard to
                        view the training statistics, always set a unique run-
                        id for each training run. (The statistics for all runs
                        with the same id are combined as if they were produced
                        by a the same session.) (default: ppo)
  --initialize-from RUN_ID
                        Specify a previously saved run ID from which to
                        initialize the model from. This can be used, for
                        instance, to fine-tune an existing model on a new
                        environment. Note that the previously saved models
                        must have the same behavior parameters as your current
                        environment. (default: None)
  --seed SEED           A number to use as a seed for the random number
                        generator used by the training code (default: -1)
  --inference           Whether to run in Python inference mode (i.e. no
                        training). Use with --resume to load a model trained
                        with an existing run ID. (default: False)
  --base-port BASE_PORT
                        The starting port for environment communication. Each
                        concurrent Unity environment instance will get
                        assigned a port sequentially, starting from the base-
                        port. Each instance will use the port (base_port +
                        worker_id), where the worker_id is sequential IDs
                        given to each instance from 0 to (num_envs - 1). Note
                        that when training using the Editor rather than an
                        executable, the base port will be ignored. (default:
                        5005)
  --num-envs NUM_ENVS   The number of concurrent Unity environment instances
                        to collect experiences from when training (default: 1)
  --num-areas NUM_AREAS
                        The number of parallel training areas in each Unity
                        environment instance. (default: 1)
  --debug               Whether to enable debug-level logging for some parts
                        of the code (default: False)
  --env-args ...        Arguments passed to the Unity executable. Be aware
                        that the standalone build will also process these as
                        Unity Command Line Arguments. You should choose
                        different argument names if you want to create
                        environment-specific arguments. All arguments after
                        this flag will be passed to the executable. (default:
                        None)
  --max-lifetime-restarts MAX_LIFETIME_RESTARTS
                        The max number of times a single Unity executable can
                        crash over its lifetime before ml-agents exits. Can be
                        set to -1 if no limit is desired. (default: 10)
  --restarts-rate-limit-n RESTARTS_RATE_LIMIT_N
                        The maximum number of times a single Unity executable
                        can crash over a period of time (period set in
                        restarts-rate-limit-period-s). Can be set to -1 to not
                        use rate limiting with restarts. (default: 1)
  --restarts-rate-limit-period-s RESTARTS_RATE_LIMIT_PERIOD_S
                        The period of time --restarts-rate-limit-n applies to.
                        (default: 60)
  --torch               (Removed) Use the PyTorch framework. (default: False)
  --tensorflow          (Removed) Use the TensorFlow framework. (default:
                        False)
  --results-dir RESULTS_DIR
                        Results base directory (default: results)

Engine Configuration:
  --width WIDTH         The width of the executable window of the
                        environment(s) in pixels (ignored for editor
                        training). (default: 84)
  --height HEIGHT       The height of the executable window of the
                        environment(s) in pixels (ignored for editor training)
                        (default: 84)
  --quality-level QUALITY_LEVEL
                        The quality level of the environment(s). Equivalent to
                        calling QualitySettings.SetQualityLevel in Unity.
                        (default: 5)
  --time-scale TIME_SCALE
                        The time scale of the Unity environment(s). Equivalent
                        to setting Time.timeScale in Unity. (default: 20)
  --target-frame-rate TARGET_FRAME_RATE
                        The target frame rate of the Unity environment(s).
                        Equivalent to setting Application.targetFrameRate in
                        Unity. (default: -1)
  --capture-frame-rate CAPTURE_FRAME_RATE
                        The capture frame rate of the Unity environment(s).
                        Equivalent to setting Time.captureFramerate in Unity.
                        (default: 60)
  --no-graphics         Whether to run the Unity executable in no-graphics
                        mode (i.e. without initializing the graphics driver.
                        Use this only if your agents don't use visual
                        observations. (default: False)

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

C:\WINDOWS\system32>
C:\WINDOWS\system32>mlagents-learn

            ┐  ╖
        ╓╖╬│╡  ││╬╖╖
    ╓╖╬│││││┘  ╬│││││╬╖
 ╖╬│││││╬╜        ╙╬│││││╖╖                               ╗╗╗
 ╬╬╬╬╖││╦╖        ╖╬││╗╣╣╣╬      ╟╣╣╬    ╟╣╣╣             ╜╜╜  ╟╣╣
 ╬╬╬╬╬╬╬╬╖│╬╖╖╓╬╪│╓╣╣╣╣╣╣╣╬      ╟╣╣╬    ╟╣╣╣ ╒╣╣╖╗╣╣╣╗   ╣╣╣ ╣╣╣╣╣╣ ╟╣╣╖   ╣╣╣
 ╬╬╬╬┐  ╙╬╬╬╬│╓╣╣╣╝╜  ╫╣╣╣╬      ╟╣╣╬    ╟╣╣╣ ╟╣╣╣╙ ╙╣╣╣  ╣╣╣ ╙╟╣╣╜╙  ╫╣╣  ╟╣╣
 ╬╬╬╬┐     ╙╬╬╣╣      ╫╣╣╣╬      ╟╣╣╬    ╟╣╣╣ ╟╣╣╬   ╣╣╣  ╣╣╣  ╟╣╣     ╣╣╣┌╣╣╜
 ╬╬╬╜       ╬╬╣╣      ╙╝╣╣╬      ╙╣╣╣╗╖╓╗╣╣╣╜ ╟╣╣╬   ╣╣╣  ╣╣╣  ╟╣╣╦╓    ╣╣╣╣╣
 ╙   ╓╦╖    ╬╬╣╣   ╓╗╗╖            ╙╝╣╣╣╣╝╜   ╘╝╝╜   ╝╝╝  ╝╝╝   ╙╣╣╣    ╟╣╣╣
   ╩╬╬╬╬╬╬╦╦╬╬╣╣╗╣╣╣╣╣╣╣╝                                             ╫╣╣╣╣
      ╙╬╬╬╬╬╬╬╣╣╣╣╣╣╝╜
          ╙╬╬╬╣╣╣╜
             ╙

 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.

pip list 했을 때 mlagents가 안 깔린 걸 확인했다.

pip install mlagents==0.28.0 로 해결됐다.