Ml-Agents Release 6 (0.19.0) Environment Construction Summary [Windows]

I had touched ML-Agents, but it was different from when I touched it before, so I tried to organize how to build the environment.

usage environment

Reference material

There are various commentary sites, but in the end, they were all written on the official website! Although it is in English, I read it with the help of Google teacher lol Installation

flow

  1. Install Unity
  2. Python installation
  3. Install ML-Agents Unity package
  4. Install mlagents Python package

Although it is written in the official manual, 1 and 3, 2 and 4 are a set, so it is okay to change the order. (Like 2 → 4 → 1 → 3)

I'll do it

1. Install Unity

Use Unity Hub to install newer than 2018.4. I have installed the latest LTS version 2019.4.10f1 at the moment (September 15, 2020).

Download - Unity

2. Python installation

I installed the latest version of Python 3.7 series from the official website. From the table that says "Looking for a specific release?", I think you should download the one at the top of the 3.7.x series (the one that was recently updated). Be sure to download the 64-bit version (the one labeled x64-86).

Download Python | Python.org

3. Install ML-Agents Unity package

Install the package in the Unity Project. This is much easier to understand than it used to be. ~~ (In the old days, it wasn't intuitive to install barracuda) ~~

Open the project you want to use ML-Agents in Unity.

Click "Window-> Package Manager" from the menu bar to open Package Manager. Then, check if the red part in the image below is the same. image.png

Then search for "ML-Agents" in the search box at the top right. Then, I think that the package of ML Agents will come out, so select it and install it from the install button at the bottom right.

This completes the installation of ML-Agents Unity Package. (It also installs dependent packages such as Barracuda at once.)

4. Install mlagents Python package

4-1. Construction of virtual environment

ML-Agents seems to use various modules of Python, and it seems that it may not work well if it is already installed (for example, the numpy module does not support the latest version), so there is no such thing. If you don't understand, let's build a virtual environment quietly. It is easy to handle when the version of ML-Agents changes.

Previously, I was told to create an environment with Anaconda, but now it seems that it is recommended to use venv.

We do not provide support for Anaconda installation on Windows.

So, I will build a virtual environment using venv.

How to build a virtual environment is also described in the official manual, "Using Virtual Environment It is written in. Kindness!

Install Pip

Install pip for the official procedure! It says, but it seems that it is installed as standard in Python 3.4 or later, so I will omit it.

To put it simply, pip is a convenient module management tool (install, update, uninstall etc ...).

Create virtual environment

First, create a folder to save the virtual environment. Move the current directory to the location where you want to create the folder in advance. I create it under my user folder (C: \ Users \ username).

Enter the following command at the command prompt or Powershell. Then, I think that a folder called "python-envs" was created.

md python-envs

Next, create a virtual environment. Enter the command below. This will create a virtual environment named "mlagents-release6". Please change this "mlagents-release6" part to your favorite name. By the way, it is "sample-env" in the official manual.

py -3.7 -m venv python-envs\mlagents-release6

Next, let's use the virtual environment created earlier. This operation is called "activate". If you don't do this, you'll get "Oh, I installed the module last time, but I can't use it", so please be careful.

.\python-envs\mlagents-release6\Scripts\activate

Execute the above command, and when the name of the virtual environment is displayed before writing the command as shown below, activation is complete.

PS C:\Users\kamekyame>
#After activation ↓
(mlagents-release6) PS C:\Users\kamekyame>

From here, we will proceed on the assumption that the virtual environment is activated.

Pip upgrade

Upgrade pip in the virtual environment to the latest version. Execute the following command.

pip install --upgrade pip

Depending on the person, the following error may appear, but it seems that pip has been upgraded for the time being, so don't worry, leave it for the time being.

ERROR: Could not install packages due to an EnvironmentError: [WinError 5]Access denied.

Installation of mlagents

Finally, it is the installation of mlagents. This area is also much easier than it used to be, and all dependent modules can now be installed with a single command line. Execute the command below.

pip install mlagents

After a while, the message Successfully installed will be displayed and the installation will be completed.

The following ERROR may appear above this Successfully installed.

ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

mlagents-envs 0.19.0 requires numpy<1.19.0,>=1.14.1, but you'll have numpy 1.19.2 which is incompatible.
tensorflow 2.3.0 requires numpy<1.19.0,>=1.16.0, but you'll have numpy 1.19.2 which is incompatible.

Well, if you ask Google teacher, it will be translated, but this is because the version of numpy already installed was 1.19.0, but with mlagents-envs and tensorflow module 1.16.0 ~ 1.1.9 (1.19) It is said that .0 is not included) is not supported.

So change the version of numpy to a version lower than 1.19.0. Execute the following command.

pip install numpy==1.18.5

This is the end of environment construction!

at the end

This is the end of environment construction! After that, use the mlagents-learn command to have a good machine learning life.

The first wall "environment construction" that you come across to do new things! ML-Agents is no exception, and it's a little confusing, but if you read the official manual carefully, you can do it properly.

ML-Agents has a lot of official manuals, and you can find out what you want to know from the official manuals. In fact, ML-Agents have many specification changes and often cannot be used with older versions of code. When looking up ML-Agents, it's a good idea to look at the official version or check the version of ML-Agents for someone's article!

I'll put a few links that I think I'll use in the end. Thank you for visiting so far m (_ _) m

Link Collection

Unity ML-Agents Github Unity ML-Agents Release 6 Source code & Sample code download page Unity ML-Agents Toolkit Documentation ← This is all Unity ML-Agents Installation Documentation

Recommended Posts

Ml-Agents Release 6 (0.19.0) Environment Construction Summary [Windows]
python windows environment construction
Python environment construction (Windows10 + Emacs)
Python environment construction under Windows7 environment
[Tensorflow] Tensorflow environment construction on Windows 10
Python environment construction memo on Windows 10
Anaconda python environment construction on Windows 10
Python project environment construction procedure (for windows)
[Windows 10] "Deep Learning from scratch" environment construction
Windows + gVim + Poetry python development environment construction
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Python environment construction
Environment construction (python)
django environment construction
CodeIgniter environment construction
python environment construction
Python --Environment construction
Python environment construction
Golang environment construction
python environment construction
Word2vec environment construction
Python environment construction (Anaconda + VSCode) @ Windows10 [January 2020 version]
Installation of Python3 and Flask [Environment construction summary]
[Django3] Environment construction and various settings summary [Python3]
Data science 100 knock (structured data processing) environment construction (Windows10)
Environment construction: GCP + Docker
Django project environment construction
ConoHa environment construction memo
PyData related environment construction
Execute Language Interpretability Tool (LIT) in Windows 10 environment (1. Environment construction)
Python development environment construction
virtualenvwrapper in windows environment
pyenv + fish environment construction
python2.7 development environment construction
BigGorilla environment construction memo
grip environment construction onCentOS6.5
Anaconda environment construction memo
Golang environment construction [goenv]
Mac environment construction Python
Pyxel environment construction (Mac)
Python environment construction @ Win7
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
Python environment construction procedure memo using Docker on Windows10 Home
Memo of Linux environment construction using VirtualBox + Vagrant on Windows 10
[Ubuntu 18.04] Tensorflow 2.0.0-GPU environment construction
Python + Anaconda + Pycharm environment construction
About Linux environment construction (CentOS)
PyTorch C ++ (LibTorch) environment construction
Anaconda environment construction on CentOS7
Django development environment construction memo
First LAMP environment construction (Linux)
Prepare Chainer environment on Windows
CI environment construction ~ Python edition ~
[Memo] Construction of cygwin environment
ML environment construction with Miniconda
Python environment construction For Mac
Anaconda3 python environment construction procedure
Build Python environment on Windows
Docker + Django + React environment construction