# Installation The ML-Agents Toolkit contains several components: - Unity package ([`com.unity.ml-agents`](../com.unity.ml-agents/)) contains the Unity C# SDK that will be integrated into your Unity project. This package contains a sample to help you get started with ML-Agents. - Unity package ([`com.unity.ml-agents.extensions`](../com.unity.ml-agents.extensions/)) contains experimental C#/Unity components that are not yet ready to be part of the base `com.unity.ml-agents` package. `com.unity.ml-agents.extensions` has a direct dependency on `com.unity.ml-agents`. - Two Python packages: - [`mlagents`](../ml-agents/) contains the machine learning algorithms that enables you to train behaviors in your Unity scene. Most users of ML-Agents will only need to directly install `mlagents`. - [`mlagents_envs`](../ml-agents-envs/) contains a set of Python APIs to interact with a Unity scene. It is a foundational layer that facilitates data messaging between Unity scene and the Python machine learning algorithms. Consequently, `mlagents` depends on `mlagents_envs`. - Unity [Project](https://github.com/Unity-Technologies/ml-agents/tree/main/Project/) that contains several [example environments](Learning-Environment-Examples.md) that highlight the various features of the toolkit to help you get started. Consequently, to install and use the ML-Agents Toolkit you will need to: - Install Unity (2022.3 or later) - Install Python (3.8.13 or higher) - Clone this repository (Optional) - __Note:__ If you do not clone the repository, then you will not be able to access the example environments and training configurations or the `com.unity.ml-agents.extensions` package. Additionally, the [Getting Started Guide](Getting-Started.md) assumes that you have cloned the repository. - Install the `com.unity.ml-agents` Unity package - Install the `com.unity.ml-agents.extensions` Unity package (Optional) - Install the `mlagents` Python package ### Install **Unity 2022.3** or Later [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. ### Install **Python 3.7.2** or Higher We recommend [installing](https://www.python.org/downloads/) Python 3.7. 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. ### Clone the ML-Agents Toolkit Repository (Optional) Now that you have installed Unity and Python, you can now install the Unity and Python packages. You do not need to clone the repository to install those packages, but you may choose to clone the repository if you'd like download our example environments and training configurations to experiment with them (some of our tutorials / guides assume you have access to our example environments). **NOTE:** There are samples shipped with the Unity Package. You only need to clone the repository if you would like to explore more examples. ```sh git clone --branch release_20 https://github.com/Unity-Technologies/ml-agents.git ``` The `--branch release_20` option will switch to the tag of the latest stable release. Omitting that will get the `main` branch which is potentially unstable. #### Advanced: Local Installation for Development You will need to clone the repository if you plan to modify or extend the ML-Agents Toolkit for your purposes. If you plan to contribute those changes back, make sure to clone the `main` branch (by omitting `--branch release_20` from the command above). See our [Contributions Guidelines](../com.unity.ml-agents/CONTRIBUTING.md) for more information on contributing to the ML-Agents Toolkit. ### Install the `com.unity.ml-agents` Unity package 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. **NOTE:** If you do not see the ML-Agents package listed in the Package Manager please follow the [advanced installation instructions](#advanced-local-installation-for-development) below. #### Advanced: Local Installation for Development 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: 1. navigating to the menu `Window` -> `Package Manager`. 1. In the package manager window click on the `+` button on the top left of the packages list). 1. Select `Add package from disk...` 1. Navigate into the `com.unity.ml-agents` folder. 1. Select the `package.json` file.