AnnaMats/ppo-Pyramids-Training
0110
1# Installation2 3The ML-Agents Toolkit contains several components:4 5- Unity package ([`com.unity.ml-agents`](../com.unity.ml-agents/)) contains the6 Unity C# SDK that will be integrated into your Unity project. This package contains7 a sample to help you get started with ML-Agents.8- Unity package9 ([`com.unity.ml-agents.extensions`](../com.unity.ml-agents.extensions/))10 contains experimental C#/Unity components that are not yet ready to be part11 of the base `com.unity.ml-agents` package. `com.unity.ml-agents.extensions`12 has a direct dependency on `com.unity.ml-agents`.13- Two Python packages:14 - [`mlagents`](../ml-agents/) contains the machine learning algorithms that15 enables you to train behaviors in your Unity scene. Most users of ML-Agents16 will only need to directly install `mlagents`.17 - [`mlagents_envs`](../ml-agents-envs/) contains a set of Python APIs to interact with18 a Unity scene. It is a foundational layer that facilitates data messaging19 between Unity scene and the Python machine learning algorithms.20 Consequently, `mlagents` depends on `mlagents_envs`.21- Unity [Project](https://github.com/Unity-Technologies/ml-agents/tree/main/Project/) that contains several22 [example environments](Learning-Environment-Examples.md) that highlight the23 various features of the toolkit to help you get started.24 25Consequently, to install and use the ML-Agents Toolkit you will need to:26 27- Install Unity (2022.3 or later)28- Install Python (3.8.13 or higher)29- Clone this repository (Optional)30 - __Note:__ If you do not clone the repository, then you will not be31 able to access the example environments and training configurations or the32 `com.unity.ml-agents.extensions` package. Additionally, the33 [Getting Started Guide](Getting-Started.md) assumes that you have cloned the34 repository.35- Install the `com.unity.ml-agents` Unity package36- Install the `com.unity.ml-agents.extensions` Unity package (Optional)37- Install the `mlagents` Python package38 39### Install **Unity 2022.3** or Later40 41[Download](https://unity3d.com/get-unity/download) and install Unity. We42strongly recommend that you install Unity through the Unity Hub as it will43enable you to manage multiple Unity versions.44 45### Install **Python 3.7.2** or Higher46 47We recommend [installing](https://www.python.org/downloads/) Python 3.7.48If you are using Windows, please install the x86-64 version and not x86.49If your Python environment doesn't include `pip3`, see these50[instructions](https://packaging.python.org/guides/installing-using-linux-tools/#installing-pip-setuptools-wheel-with-linux-package-managers)51on installing it.52 53### Clone the ML-Agents Toolkit Repository (Optional)54 55Now that you have installed Unity and Python, you can now install the Unity and56Python packages. You do not need to clone the repository to install those57packages, but you may choose to clone the repository if you'd like download our58example environments and training configurations to experiment with them (some59of our tutorials / guides assume you have access to our example environments).60 61**NOTE:** There are samples shipped with the Unity Package. You only need to clone62the repository if you would like to explore more examples.63 64```sh65git clone --branch release_20 https://github.com/Unity-Technologies/ml-agents.git66```67 68The `--branch release_20` option will switch to the tag of the latest stable69release. Omitting that will get the `main` branch which is potentially unstable.70 71#### Advanced: Local Installation for Development72 73You will need to clone the repository if you plan to modify or extend the74ML-Agents Toolkit for your purposes. If you plan to contribute those changes75back, make sure to clone the `main` branch (by omitting `--branch release_20`76from the command above). See our77[Contributions Guidelines](../com.unity.ml-agents/CONTRIBUTING.md) for more78information on contributing to the ML-Agents Toolkit.79 80### Install the `com.unity.ml-agents` Unity package81 82The Unity ML-Agents C# SDK is a Unity Package. You can install the83`com.unity.ml-agents` package84[directly from the Package Manager registry](https://docs.unity3d.com/Manual/upm-ui-install.html).85Please make sure you enable 'Preview Packages' in the 'Advanced' dropdown in86order to find the latest Preview release of the package.87 88**NOTE:** If you do not see the ML-Agents package listed in the Package Manager89please follow the [advanced installation instructions](#advanced-local-installation-for-development) below.90 91#### Advanced: Local Installation for Development92 93You can [add the local](https://docs.unity3d.com/Manual/upm-ui-local.html)94`com.unity.ml-agents` package (from the repository that you just cloned) to your95project by:96 971. navigating to the menu `Window` -> `Package Manager`.981. In the package manager window click on the `+` button on the top left of the packages list).991. Select `Add package from disk...`1001. Navigate into the `com.unity.ml-agents` folder.1011. Select the `package.json` file.102 103<p align="center">104 <img src="../images/unity_package_manager_window.png"105 alt="Unity Package Manager Window"106 height="150"107 border="10" />108 <img src="../images/unity_package_json.png"109 alt="package.json"110 height="150"111 border="10" />112</p>113 114If you are going to follow the examples from our documentation, you can open the115`Project` folder in Unity and start tinkering immediately.116 117### Install the `com.unity.ml-agents.extensions` Unity package (Optional)118 119To install the `com.unity.ml-agents.extensions` package, you need to first120clone the repo and then complete a local installation similar to what was121outlined in the previous122[Advanced: Local Installation for Development](#advanced-local-installation-for-development-1)123section. Complete installation steps can be found in the124[package documentation](../com.unity.ml-agents.extensions/Documentation~/com.unity.ml-agents.extensions.md#installation).125 126### Install the `mlagents` Python package127 128Installing the `mlagents` Python package involves installing other Python129packages that `mlagents` depends on. So you may run into installation issues if130your machine has older versions of any of those dependencies already installed.131Consequently, our supported path for installing `mlagents` is to leverage Python132Virtual Environments. Virtual Environments provide a mechanism for isolating the133dependencies for each project and are supported on Mac / Windows / Linux. We134offer a dedicated [guide on Virtual Environments](Using-Virtual-Environment.md).135 136#### (Windows) Installing PyTorch137 138On Windows, you'll have to install the PyTorch package separately prior to139installing ML-Agents. Activate your virtual environment and run from the command line:140 141```sh142pip3 install torch~=1.7.1 -f https://download.pytorch.org/whl/torch_stable.html143```144 145Note that on Windows, you may also need Microsoft's146[Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)147if you don't have it already. See the [PyTorch installation guide](https://pytorch.org/get-started/locally/)148for more installation options and versions.149 150#### Installing `mlagents`151 152To install the `mlagents` Python package, activate your virtual environment and153run from the command line:154 155```sh156python -m pip install mlagents==0.30.0157```158 159Note that this will install `mlagents` from PyPi, _not_ from the cloned160repository. If you installed this correctly, you should be able to run161`mlagents-learn --help`, after which you will see the command162line parameters you can use with `mlagents-learn`.163 164By installing the `mlagents` package, the dependencies listed in the165[setup.py file](../ml-agents/setup.py) are also installed. These include166[PyTorch](Background-PyTorch.md) (Requires a CPU w/ AVX support).167 168#### Advanced: Local Installation for Development169 170If you intend to make modifications to `mlagents` or `mlagents_envs`, you should171install the packages from the cloned repository rather than from PyPi. To do172this, you will need to install `mlagents` and `mlagents_envs` separately. From173the repository's root directory, run:174 175```sh176pip3 install torch -f https://download.pytorch.org/whl/torch_stable.html177pip3 install -e ./ml-agents-envs178pip3 install -e ./ml-agents179```180 181Running pip with the `-e` flag will let you make changes to the Python files182directly and have those reflected when you run `mlagents-learn`. It is important183to install these packages in this order as the `mlagents` package depends on184`mlagents_envs`, and installing it in the other order will download185`mlagents_envs` from PyPi.186 187## Next Steps188 189The [Getting Started](Getting-Started.md) guide contains several short tutorials190on setting up the ML-Agents Toolkit within Unity, running a pre-trained model,191in addition to building and training environments.192 193## Help194 195If you run into any problems regarding ML-Agents, refer to our [FAQ](FAQ.md) and196our [Limitations](Limitations.md) pages. If you can't find anything please197[submit an issue](https://github.com/Unity-Technologies/ml-agents/issues) and198make sure to cite relevant information on OS, Python version, and exact error199message (whenever possible).200 