{"id":1494,"date":"2022-10-13T14:22:55","date_gmt":"2022-10-13T21:22:55","guid":{"rendered":"https:\/\/blogs.ubc.ca\/cogs300\/?page_id=1494"},"modified":"2024-02-25T21:09:57","modified_gmt":"2024-02-26T04:09:57","slug":"ml-agents-install-instructions-for-v2-0-1","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/cogs300\/ml-agents-install-instructions-for-v2-0-1\/","title":{"rendered":"Unity ML Agents Install Instructions (for V2.0.1+)"},"content":{"rendered":"<h1>ML Agents Install Guide (V2.0.1)<\/h1>\n<p>The new versions of ML Agents also require a different version of python and the ML Agents package. This is the install guide for those new versions.<\/p>\n<h2>Windows Guide<\/h2>\n<p>1.Go to <a href=\"https:\/\/www.python.org\/downloads\/release\/python-3810\/\" target=\"_blank\" rel=\"noopener\">the python 3.8.10 download page<\/a><br \/>\n2. Download the <strong>64 bit version of python 3.8<\/strong> for windows<br \/>\n<a href=\"https:\/\/blogs.ubc.ca\/cogs300\/ml-agents-install-instructions-for-v2-0-1\/download-python\/\" rel=\"attachment wp-att-1496\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1496\" src=\"https:\/\/blogs.ubc.ca\/cogs300\/files\/2022\/10\/Download-Python.gif\" alt=\"\" width=\"520\" height=\"293\" \/><\/a><\/p>\n<p>3. When this is done, open the downloaded file<br \/>\n4. <span style=\"color: #ff0000;\"><strong>!!! Select &#8220;Add Python 3.8 to Path&#8221; !!!<\/strong><\/span><br \/>\n5. Continue the installation<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1498\" src=\"https:\/\/blogs.ubc.ca\/cogs300\/files\/2022\/10\/Install-Python.gif\" alt=\"\" width=\"520\" height=\"293\" \/><\/p>\n<p>6.Open your command prompt by typing &#8220;cmd&#8221; into the windows menu<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1500\" src=\"https:\/\/blogs.ubc.ca\/cogs300\/files\/2022\/10\/Open-CMD.gif\" alt=\"\" width=\"520\" height=\"293\" \/><\/p>\n<p>7. Copy and paste the following command to install pytorch<\/p>\n<pre><code>py -3.8 -m pip install torch~=1.7.1 -f https:\/\/download.pytorch.org\/whl\/torch_stable.html<\/code><\/pre>\n<p><a href=\"https:\/\/blogs.ubc.ca\/cogs300\/ml-agents-install-instructions-for-v2-0-1\/install-pytorch\/\" rel=\"attachment wp-att-1499\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1499\" src=\"https:\/\/blogs.ubc.ca\/cogs300\/files\/2022\/10\/Install-Pytorch.gif\" alt=\"\" width=\"520\" height=\"293\" \/><\/a><\/p>\n<p>8. After the previous command finishes, copy and paste the following command to install ML Agents<\/p>\n<pre><code> py -3.8 -m pip install mlagents==0.28.0 <\/code><\/pre>\n<p><a href=\"https:\/\/blogs.ubc.ca\/cogs300\/ml-agents-install-instructions-for-v2-0-1\/install-ml-agents\/\" rel=\"attachment wp-att-1497\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1497\" src=\"https:\/\/blogs.ubc.ca\/cogs300\/files\/2022\/10\/Install-ML-Agents.gif\" alt=\"\" width=\"520\" height=\"293\" \/><\/a><\/p>\n<p>9. If everything worked properly, you should be able to type in the following command without any errors<\/p>\n<pre><code>mlagents-learn --help <\/code><\/pre>\n<p><a href=\"https:\/\/blogs.ubc.ca\/cogs300\/ml-agents-install-instructions-for-v2-0-1\/check-help-command\/\" rel=\"attachment wp-att-1495\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1495\" src=\"https:\/\/blogs.ubc.ca\/cogs300\/files\/2022\/10\/Check-Help-Command.gif\" alt=\"\" width=\"520\" height=\"293\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Mac Guide<\/h2>\n<h3><strong>For Mac M1 (or newer) chip<\/strong><\/h3>\n<ol>\n<li>Install <a href=\"https:\/\/docs.conda.io\/en\/latest\/miniconda.html\">Conda<\/a> and create a new virtual environment named <strong>unity-mla<\/strong><\/li>\n<li>Go to your terminal<\/li>\n<li>Copy and paste this following sequence into your terminal:\n<ol>\n<li>\n<pre>conda create -n unity-mla python=3.9.7 -y<\/pre>\n<\/li>\n<li>\n<pre>conda activate unity-mla<\/pre>\n<\/li>\n<li>\n<pre>conda install -c conda-forge pytorch=1.8 -y<\/pre>\n<\/li>\n<li>\n<pre>conda install grpcio h5py -y<\/pre>\n<\/li>\n<li>\n<pre>pip install mlagents==0.28.0 -q<\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<li>If everything worked properly, you should be able to type in the following command without any errors\n<pre><code>mlagents-learn --help <\/code><\/pre>\n<\/li>\n<\/ol>\n<h3><strong>For older Macs that use Intel chips<\/strong><\/h3>\n<p>1. Go to <a href=\"https:\/\/www.python.org\/downloads\/release\/python-3810\/\" target=\"_blank\" rel=\"noopener\">the python 3.8.10 download page<\/a><br \/>\n2. Download the <strong>64 bit version of python 3.8<\/strong> for macOS<\/p>\n<p>3. When this is done, open the downloaded file<br \/>\n5. Continue the installation<\/p>\n<p>6. Open your command prompt by typing &#8220;terminal&#8221; into the search bar<\/p>\n<p>7. Copy and paste the following command to install pytorch<\/p>\n<pre><code>pip3 install torch~=1.7.1 -f https:\/\/download.pytorch.org\/whl\/torch_stable.html<\/code><\/pre>\n<p>8. After the previous command finishes, copy and paste the following command to install ML Agents<\/p>\n<pre><code>pip3 install mlagents==0.28.0 <\/code><\/pre>\n<p>9. If everything worked properly, you should be able to type in the following command without any errors<\/p>\n<p><code>mlagents-learn --help<\/code><\/p>\n<p>&nbsp;<\/p>\n<h3>Debugging<\/h3>\n<p>&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ML Agents Install Guide (V2.0.1) The new versions of ML Agents also require a different version of python and the ML Agents package. This is the install guide for those new versions. Windows Guide 1.Go to the python 3.8.10 download page 2. Download the 64 bit version of python 3.8 for windows 3. When this [&hellip;]<\/p>\n","protected":false},"author":58788,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1494","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/pages\/1494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/users\/58788"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/comments?post=1494"}],"version-history":[{"count":23,"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/pages\/1494\/revisions"}],"predecessor-version":[{"id":1630,"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/pages\/1494\/revisions\/1630"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/cogs300\/wp-json\/wp\/v2\/media?parent=1494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}