Skip to content

Instantly share code, notes, and snippets.

Last active May 5, 2021 19:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?



  • Install the Unity Hub
  • Use the hub to install the latest LTS (long-term support) editor (e.g., 2020.3.6f1 LTS)
  • No additional modules are needed during the editor install, so accept the defaults



  • Use the hub to add a NEW project
    • Specify the location for the project
    • The default editor will be used


  • Use the hub to ADD an existing project
    • Select the folder that contains the project and it will import it and launch the editor


  • When using git, be sure to include a Unity-specific .gitignore, as Unity projects include many large intermediate files that are not necessary to preserve in a repo

Main Concepts


ML-Agents Toolkit


ML-Agents requires use of Python. There are a variety of ways to get Python working on your system, depending on OS, package manager, IDE, or data science environment (e.g., Anaconda). We won't cover them all here, rather just provide a few notes that might be useful, depending on your circumstances.

Note that the Python setup instructions suggest to create a system-wide virtual environments folder (e.g., ~/python-envs), we prefer to keep virtual environments within a repo/project root

Virtual environments are specific to each user, so they are excluded from the git repository and you should create your own. The project-level .gitignore excludes the venv directory at the repo/project root

For the latest version of Python, check the official releases page, which is useful when using pyenv to manage version (see below), or with pyenv itself:

pyenv install --list

From The right and wrong way to set python 3 as default on a mac:

pyenv install 3.9.4
pyenv global 3.9.4

Add the following to your .bashrc, .bash_profile, .zshrc, or whatever is your preference:

if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"

Confirm after sourcing or opening a new terminal:

python --version
Python 3.9.4

To activate the environment:

source venv/bin/activate

and note that your prompt has been modified with a prefix of venv.


The official Python installer can be used to install the latest version.

Be sure to "Install for all users" in order to use virtual environments (venv) due to this issue.

mlagents Python Packages

First, ensure you have the latest pip (within your virtual environment):

python -m pip install --upgrade pip

Install PyTorch (Windows Only):

pip3 install torch~=1.7.1 -f

Install the mlagents Python package:

python -m pip install mlagents==0.26.0

This will install all the required dependencies (e.g., PyTorch, Tensorboard).

Confirm the installation was successful with the following command (it might take awhile):

mlagents-learn --help


mlagents-learn --run-id=<model name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment