-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Update installation doc #6242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update installation doc #6242
Changes from 24 commits
ffbb5b2
bf59b0e
fa7742e
6740d89
3928cba
73d1328
3af83de
4a06dc6
2aa55e9
1ce089a
a891e80
dd42896
a1f33a5
ec40182
be3d72e
20f90ba
2294f78
4662162
760a7b7
f6267ec
6a52b36
06f857b
bb4f061
cde4f67
7595b2c
e572d13
dfaa711
42b8a01
df05b25
1bdcd93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ The table below shows our latest release, including our `develop` branch which i | |
|
|
||
| | **Version** | **Release Date** | **Source** | **Documentation** | **Download** | **Python Package** | **Unity Package** | | ||
| |:----------------------:|:-------------------:|:-----------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------:|:-----------------------------------------------------:|:-------------------------------------------------------------------------------------:| | ||
| | **Release 23** | **August 15, 2025** | **[source](https://github.com/Unity-Technologies/ml-agents/tree/release_23)** | **[docs](https://docs.unity3d.com/Packages/[email protected]/manual/index.html)** | **[download](https://github.com/Unity-Technologies/ml-agents/archive/release_23.zip)** | **[1.1.0](https://pypi.org/project/mlagents/1.1.0/)** | **4.0.0** | | ||
| | **Release 23** | **August 28, 2025** | **[source](https://github.com/Unity-Technologies/ml-agents/tree/release_23)** | **[docs](https://docs.unity3d.com/Packages/[email protected]/manual/index.html)** | **[download](https://github.com/Unity-Technologies/ml-agents/archive/release_23.zip)** | **[1.1.0](https://pypi.org/project/mlagents/1.1.0/)** | **4.0.0** | | ||
| | **develop (unstable)** | -- | [source](https://github.com/Unity-Technologies/ml-agents/tree/develop) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/develop/com.unity.ml-agents/Documentation~/index.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/develop.zip) | -- | -- | | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,73 +2,50 @@ | |||||||||||||||||||||||||||||||||
| To install and use the ML-Agents Toolkit, follow the steps below. Detailed instructions for each step are provided later on this page. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. Install Unity (6000.0 or later) | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| 2. Install Python (>= 3.10.1, <=3.10.12) - we recommend using 3.10.12 | ||||||||||||||||||||||||||||||||||
| 3. Install the `com.unity.ml-agents` Unity package; or clone this repository and install locally (recommended for the latest version and bug fixes) | ||||||||||||||||||||||||||||||||||
| 4. Install `mlagents-envs` | ||||||||||||||||||||||||||||||||||
| 5. Install `mlagents` | ||||||||||||||||||||||||||||||||||
| 2. Install Python using conda (>= 3.10.1, <=3.10.12) - we recommend using 3.10.12 | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| 3. Install ML-Agents using one of the following methods: | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Install **Unity 6000.0** or Later | ||||||||||||||||||||||||||||||||||
| 3.1 Package installation | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| [Download](https://unity3d.com/get-unity/download) and install Unity. We strongly recommend that you install Unity through the Unity Hub as it will enable you to manage multiple Unity versions. | ||||||||||||||||||||||||||||||||||
| 3.2 Advanced installation | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## 1. Install **Unity 6000.0** or Later | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Install **Python 3.10.12** | ||||||||||||||||||||||||||||||||||
| [Download](https://unity3d.com/get-unity/download) and install Unity. We strongly recommend that you install Unity through the Unity Hub as it will enable you to manage multiple Unity versions. | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| We recommend [installing](https://www.python.org/downloads/) Python 3.10.12. If you are using Windows, please install the x86-64 version and not x86. If your Python environment doesn't include `pip3`, see these [instructions](https://packaging.python.org/guides/installing-using-linux-tools/#installing-pip-setuptools-wheel-with-linux-package-managers) on installing it. We also recommend using [conda](https://docs.conda.io/en/latest/) or [mamba](https://github.com/mamba-org/mamba) to manage your python virtual environments. | ||||||||||||||||||||||||||||||||||
| ## 2. Install **Python 3.10.12** using Conda | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #### Conda python setup | ||||||||||||||||||||||||||||||||||
| We recommend using [conda](https://docs.conda.io/en/latest/) or [mamba](https://github.com/mamba-org/mamba) to install and manage Python environments. | ||||||||||||||||||||||||||||||||||
maryamziaa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Once conda has been installed in your system, open a terminal and execute the following commands to setup a python 3.10.12 virtual environment and activate it. | ||||||||||||||||||||||||||||||||||
| Once conda has been installed on your system, open a terminal and execute the following commands to set up a Python 3.10.12 virtual environment and activate it: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| Once conda has been installed on your system, open a terminal and execute the following commands to set up a Python 3.10.12 virtual environment and activate it: | |
| To install Python, follow these steps: | |
| 1. Install [Conda](https://docs.conda.io/en/latest/) or [Mamba](https://github.com/mamba-org/mamba). | |
| 2. Open a terminal and create a new Conda environment with Python 3.10.12: | |
| ```shell | |
| conda create -n mlagents python=3.10.12 && conda activate mlagents |
-
On Windows, install PyTorch separately to ensure CUDA support:
pip3 install torch~=2.2.1 --index-url https://download.pytorch.org/whl/cu121
If prompted, install Microsoft Visual C++ Redistributable. For more installation options and versions, refer to the PyTorch installation guide.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ```shell |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| conda create -n mlagents python=3.10.12 && conda activate mlagents |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ``` |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| On Windows, you'll have to install the PyTorch package separately prior to installing ML-Agents in order to make sure the cuda-enabled version is used, rather than the CPU-only version. Activate your virtual environment and run from the command line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ```sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| pip3 install torch~=2.2.1 --index-url https://download.pytorch.org/whl/cu121 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ``` |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Note that on Windows, you may also need Microsoft's Visual C++ Redistributable if you don't have it already. See the [PyTorch installation guide](https://pytorch.org/get-started/locally/) for more installation options and versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## 3.1 Install ML-Agents - Package Installation | |
| ## Install ML-Agents |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Use this installation method if you do not plan to modify or extend the ML-Agents Toolkit for your purposes and you don't need access to our example environments. | |
| You can install ML-Agents in two ways: | |
| * Package installation: Recommended for most users who want to use ML-Agents without modifying the source code. | |
| * Advanced installation: For contributors, developers extending ML-Agents, or users who want access to the example environments. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### 3.1.1 Install the `com.unity.ml-agents` Unity package | |
| ### Install ML-Agents (Package installation) | |
| Use this method if you don’t plan to modify the toolkit or need the example environments. | |
| #### Install the Unity package | |
| To install the package, follow these steps: | |
| 1. In Unity, open **Window** > **Package Manager**. | |
| 2. Select **+** > **Add package by name**. | |
| 3. Enter `com.unity.ml-agents`. | |
| 4. Enable **Preview Packages** under the **Advanced** drop-down list if the package doesn’t appear. | |
| If the package isn’t listed, follow the [Advanced Installation](#32-install-ml-agents---advanced-installation) method instead. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The Unity ML-Agents C# SDK is a Unity Package. You can install the `com.unity.ml-agents` package [directly from the Package Manager registry](https://docs.unity3d.com/Manual/upm-ui-install.html). Please make sure you enable 'Preview Packages' in the 'Advanced' dropdown in order to find the latest Preview release of the package. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **NOTE:** If you do not see the ML-Agents package listed in the Package Manager please follow the [Advanced Installation](#32-install-ml-agents---advanced-installation) instructions at the bottom of this page. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### 3.1.2 Install Python package | |
| ### Install the Python package |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Installing the `mlagents` Python package involves installing other Python packages that `mlagents` depends on. So you may run into installation issues if your machine has older versions of any of those dependencies already installed. Consequently, our supported path for installing `mlagents` is to leverage Python Virtual Environments. Virtual Environments provide a mechanism for isolating the dependencies for each project and are supported on Mac / Windows / Linux. We offer a dedicated [guide on Virtual Environments](Using-Virtual-Environment.md). | |
| Install the ML-Agents Python package to enable communication between Unity and your machine learning training environment. | |
| Using a Python virtual environment helps isolate project dependencies and prevent version conflicts across your system. Virtual environments are supported on macOS, Windows, and Linux. For more information, refer to [Using Virtual Environments](https://github.com/Unity-Technologies/ml-agents/pull/6242/files/Using-Virtual-Environment.md). | |
| 1. Before installing ML-Agents, activate the Conda environment you created: | |
conda activate mlagents
2. Install the ML-Agents Python package from the Python Package Index (PyPI):
python -m pip install mlagents==1.1.0
Make sure to install a Python package version that matches your Unity ML-Agents package version. For information on compatible versions, refer to the [ML-Agents release history](https://github.com/Unity-Technologies/ml-agents/releases).
3. If you encounter an error while building the `grpcio` wheel, install it separately before reinstalling ML-Agents:
conda install "grpcio=1.48.2" -c conda-forge
This step resolves dependency conflicts that can occur with older versions of `grpcio`.
4. When the installation completes successfully, all the required Python dependencies listed in the [setup.py file](https://github.com/Unity-Technologies/ml-agents/blob/release/4.0.0/ml-agents/setup.py), including [PyTorch](Background-PyTorch.md) are automatically configured.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You can install the ML-Agents Python package directly from PyPi. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **Important:** Ensure you install a Python package version that matches your Unity package version. Check the [release history](https://github.com/Unity-Technologies/ml-agents/releases) to find compatible versions. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| When you install the Python package, the dependencies listed in the [setup.py file](https://github.com/Unity-Technologies/ml-agents/blob/release/4.0.0/ml-agents/setup.py) are also installed. These include [PyTorch](Background-PyTorch.md). |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## 3.2 Install ML-Agents - Advanced Installation | |
| ### Install ML-Agents (Advanced Installation) | |
| Use the advanced installation method if you plan to modify or extend the ML-Agents Toolkit, or if you want to download and use the example environments included in the repository. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You will need to clone the repository if you plan to modify or extend the ML-Agents Toolkit for your purposes, or if you'd like to download our example environments. Some of our tutorials / guides assume you have access to our example environments. | |
| #### Clone the ML-Agents repository | |
| Clone the ML-Agents repository to access the source code, sample environments, and development branches. | |
| To clone the latest stable release, run: | |
git clone --branch release_23 https://github.com/Unity-Technologies/ml-agents.git
The `--branch release_23` flag checks out the latest stable release. If you omit this option, the `develop` branch is cloned instead, which may contain experimental or unstable changes.
If the `release` branch does not work as expected, switch to the `develop` branch. It may include fixes for dependency or compatibility issues.
To clone the bleeding-edge development version (optional), run:
git clone https://github.com/Unity-Technologies/ml-agents.git
If you plan to contribute your changes, clone the `develop` branch (omit the `--branch` flag). For more information, refer to the [Contribution Guidelines](https://github.com/Unity-Technologies/ml-agents/pull/6242/files/CONTRIBUTING.md).
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The `--branch release_23` option will switch to the tag of the latest stable release. Omitting that will get the `develop` branch which is potentially unstable. However, if you find that a release branch does not work, the recommendation is to use the `develop` branch as it may have potential fixes for bugs and dependency issues. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To get the bleeding-edge development version (optional): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ```sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| git clone https://github.com/Unity-Technologies/ml-agents.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ``` |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If you plan to contribute those changes back, make sure to clone the `develop` branch (by omitting `--branch release_23` from the command above). See our [Contributions Guidelines](CONTRIBUTING.md) for more information on contributing to the ML-Agents Toolkit. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### 3.2.1 Add the `com.unity.ml-agents` Unity package | |
| #### Add the ML-Agents Unity package | |
| After cloning the repository, add the `com.unity.ml-agents` Unity package to your project. | |
| To add the local package, follow these steps: | |
| 1. In the Unity Editor, go to **Window** > **Package Manager**. | |
| 2. In the **Package Manager** window, select **+**. | |
| 3. Select **Add package from disk**. | |
| 4. Navigate to the cloned repository and open the `com.unity.ml-agents` folder. | |
| 5. Select the `package.json` file. | |
| Unity adds the ML-Agents package to your project. | |
| If you plan to use the example environments provided in the repository, open the **Project** folder in Unity to explore and experiment with them. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You can [add the local](https://docs.unity3d.com/Manual/upm-ui-local.html) `com.unity.ml-agents` package (from the repository that you just cloned) to your project by: |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1. Navigating to the menu `Window` -> `Package Manager`. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 2. In the package manager window, click on the `+` button on the top left of the packages list. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 3. Select `Add package from disk...` |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 4. Navigate into the `com.unity.ml-agents` folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 5. Select the `package.json` file. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If you are going to follow the examples from our documentation, you can open the `Project` folder in Unity and start tinkering immediately. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### 3.2.2 Install Python package | |
| #### Install the ML-Agents Python package | |
| Install the Python packages from the cloned repository to enable training and environment communication. | |
| 1. From the root of the cloned repository, activate your virtual environment and run: | |
cd /path/to/ml-agents
python -m pip install ./ml-agents-envs
python -m pip install ./ml-agents
This installs the ML-Agents packages directly from the cloned source, not from PyPI.
2. To confirm a successful installation, run:
mlagents-learn --help
If the command lists available parameters, your setup is complete.
3. If you plan to modify the ML-Agents source code or contribute changes, install the packages in editable mode.
Editable installs let you make live changes to the Python files and test them immediately.
From the repository’s root directory, run:
pip3 install torch -f https://download.pytorch.org/whl/torch_stable.html
pip3 install -e ./ml-agents-envs
pip3 install -e ./ml-agents
> [!NOTE]
> Install the packages in this order. The `mlagents` package depends on `mlagents_envs`. Installing them in the reverse order causes `mlagents_envs` to be downloaded from PyPI, which can cause version mismatches.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may please delete all the following information as it has been covered in the steps above.
Uh oh!
There was an error while loading. Please reload this page.