blob: d924f760b0e1a893b54b2e2158bca58206d6c4aa [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Installing MXNet" />
<meta property="og:image" content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" />
<meta property="og:image:secure_url" content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" />
<meta property="og:description" content="Installing MXNet" />
<title>Installing MXNet &mdash; mxnet documentation</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/mxnet.css" type="text/css">
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/searchtools_custom.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/selectlang.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript"> jQuery(function() { Search.loadIndex("/versions/1.3.1/searchindex.js"); Search.init();}); </script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new
Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-96378503-1', 'auto');
ga('send', 'pageview');
</script>
<!-- -->
<!-- <script type="text/javascript" src="../_static/jquery.js"></script> -->
<!-- -->
<!-- <script type="text/javascript" src="../_static/underscore.js"></script> -->
<!-- -->
<!-- <script type="text/javascript" src="../_static/doctools.js"></script> -->
<!-- -->
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> -->
<!-- -->
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="icon" type="image/png" href="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-icon.png">
</head>
<body role="document" background="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-background-compressed.jpeg">
<div class='content-block'><div class="navbar navbar-fixed-top">
<div class="container" id="navContainer">
<div id="header-inner" class="innder">
<h1 id="logo-wrap">
<a href="../" id="logo"><img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet_logo.png"></a>
</h1>
<nav class="nav-bar" id="main-nav">
<a class="main-nav-link" href="/versions/1.3.1/install/index.html">Install</a>
<span id="dropdown-menu-position-anchor">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Gluon <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.3.1/tutorials/gluon/gluon.html">About</a></li>
<li><a class="main-nav-link" href="https://www.d2l.ai/">Dive into Deep Learning</a></li>
<li><a class="main-nav-link" href="https://gluon-cv.mxnet.io">GluonCV Toolkit</a></li>
<li><a class="main-nav-link" href="https://gluon-nlp.mxnet.io/">GluonNLP Toolkit</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">API <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.3.1/api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/clojure/index.html">Clojure</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/perl/index.html">Perl</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/scala/index.html">Scala</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor-docs">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Docs <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-docs">
<li><a class="main-nav-link" href="/versions/1.3.1/faq/index.html">FAQ</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/tutorials/index.html">Tutorials</a>
<li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.3.1/example">Examples</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/architecture/index.html">Architecture</a></li>
<li><a class="main-nav-link" href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home">Developer Wiki</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/model_zoo/index.html">Model Zoo</a></li>
<li><a class="main-nav-link" href="https://github.com/onnx/onnx-mxnet">ONNX</a></li>
</li></ul>
</span>
<span id="dropdown-menu-position-anchor-community">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Community <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-community">
<li><a class="main-nav-link" href="http://discuss.mxnet.io">Forum</a></li>
<li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.3.1">Github</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/community/contribute.html">Contribute</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/community/ecosystem.html">Ecosystem</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/community/powered_by.html">Powered By</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor-version" style="position: relative"><a href="#" class="main-nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">1.3.1<span class="caret"></span></a><ul id="package-dropdown-menu" class="dropdown-menu"><li><a href="/">master</a></li><li><a href="/versions/1.7.0/">1.7.0</a></li><li><a href=/versions/1.6.0/>1.6.0</a></li><li><a href=/versions/1.5.0/>1.5.0</a></li><li><a href=/versions/1.4.1/>1.4.1</a></li><li><a href=/versions/1.3.1/>1.3.1</a></li><li><a href=/versions/1.2.1/>1.2.1</a></li><li><a href=/versions/1.1.0/>1.1.0</a></li><li><a href=/versions/1.0.0/>1.0.0</a></li><li><a href=/versions/0.12.1/>0.12.1</a></li><li><a href=/versions/0.11.0/>0.11.0</a></li></ul></span></nav>
<script> function getRootPath(){ return "../" } </script>
<div class="burgerIcon dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"></a>
<ul class="dropdown-menu" id="burgerMenu">
<li><a href="/versions/1.3.1/install/index.html">Install</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/tutorials/index.html">Tutorials</a></li>
<li class="dropdown-submenu dropdown">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Gluon</a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.3.1/tutorials/gluon/gluon.html">About</a></li>
<li><a class="main-nav-link" href="http://gluon.mxnet.io">The Straight Dope (Tutorials)</a></li>
<li><a class="main-nav-link" href="https://gluon-cv.mxnet.io">GluonCV Toolkit</a></li>
<li><a class="main-nav-link" href="https://gluon-nlp.mxnet.io/">GluonNLP Toolkit</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">API</a>
<ul class="dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.3.1/api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/clojure/index.html">Clojure</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/perl/index.html">Perl</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="/versions/1.3.1/api/scala/index.html">Scala</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Docs</a>
<ul class="dropdown-menu">
<li><a href="/versions/1.3.1/faq/index.html" tabindex="-1">FAQ</a></li>
<li><a href="/versions/1.3.1/tutorials/index.html" tabindex="-1">Tutorials</a></li>
<li><a href="https://github.com/apache/incubator-mxnet/tree/1.3.1/example" tabindex="-1">Examples</a></li>
<li><a href="/versions/1.3.1/architecture/index.html" tabindex="-1">Architecture</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home" tabindex="-1">Developer Wiki</a></li>
<li><a href="/versions/1.3.1/model_zoo/index.html" tabindex="-1">Gluon Model Zoo</a></li>
<li><a href="https://github.com/onnx/onnx-mxnet" tabindex="-1">ONNX</a></li>
</ul>
</li>
<li class="dropdown-submenu dropdown">
<a aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" role="button" tabindex="-1">Community</a>
<ul class="dropdown-menu">
<li><a href="http://discuss.mxnet.io" tabindex="-1">Forum</a></li>
<li><a href="https://github.com/apache/incubator-mxnet/tree/1.3.1" tabindex="-1">Github</a></li>
<li><a href="/versions/1.3.1/community/contribute.html" tabindex="-1">Contribute</a></li>
<li><a href="/versions/1.3.1/community/ecosystem.html" tabindex="-1">Ecosystem</a></li>
<li><a href="/versions/1.3.1/community/powered_by.html" tabindex="-1">Powered By</a></li>
</ul>
</li>
<li id="dropdown-menu-position-anchor-version-mobile" class="dropdown-submenu" style="position: relative"><a href="#" tabindex="-1">1.3.1</a><ul class="dropdown-menu"><li><a tabindex="-1" href=/>master</a></li><li><a tabindex="-1" href=/versions/1.6.0/>1.6.0</a></li><li><a tabindex="-1" href=/versions/1.5.0/>1.5.0</a></li><li><a tabindex="-1" href=/versions/1.4.1/>1.4.1</a></li><li><a tabindex="-1" href=/versions/1.3.1/>1.3.1</a></li><li><a tabindex="-1" href=/versions/1.2.1/>1.2.1</a></li><li><a tabindex="-1" href=/versions/1.1.0/>1.1.0</a></li><li><a tabindex="-1" href=/versions/1.0.0/>1.0.0</a></li><li><a tabindex="-1" href=/versions/0.12.1/>0.12.1</a></li><li><a tabindex="-1" href=/versions/0.11.0/>0.11.0</a></li></ul></li></ul>
</div>
<div class="plusIcon dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
<ul id="plusMenu" class="dropdown-menu dropdown-menu-right"></ul>
</div>
<div id="search-input-wrap">
<form class="" role="search" action="../search.html" method="get" autocomplete="off">
<div class="form-group inner-addon left-addon">
<i class="glyphicon glyphicon-search"></i>
<input type="text" name="q" class="form-control" placeholder="Search">
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<div id="search-preview"></div>
</div>
<div id='searchIcon'>
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</div>
<!-- <div id="lang-select-wrap"> -->
<!-- <label id="lang-select-label"> -->
<!-- <\!-- <i class="fa fa-globe"></i> -\-> -->
<!-- <span></span> -->
<!-- </label> -->
<!-- <select id="lang-select"> -->
<!-- <option value="en">Eng</option> -->
<!-- <option value="zh">中文</option> -->
<!-- </select> -->
<!-- </div> -->
<!-- <a id="mobile-nav-toggle">
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
</a> -->
</div>
</div>
</div>
<script type="text/javascript">
$('body').css('background', 'white');
</script>
<div class="container">
<div class="row">
<div class="sphinxsidebar leftsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api/python/index.html">Python Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api/r/index.html">R Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api/julia/index.html">Julia Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api/c++/index.html">C++ Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api/scala/index.html">Scala Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api/perl/index.html">Perl Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">HowTo Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../architecture/index.html">System Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorials/index.html">Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="../community/contribute.html">Community</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="page-tracker"></div>
<div class="section" id="installing-mxnet">
<span id="installing-mxnet"></span><h1>Installing MXNet<a class="headerlink" href="#installing-mxnet" title="Permalink to this headline"></a></h1>
<p>Indicate your preferred configuration. Then, follow the customized commands to install <em>MXNet</em>.</p>
<div class="dropdown">
<button class="btn current-version btn-primary dropdown-toggle" type="button" data-toggle="dropdown">v1.2.1
<span class="caret"></span></button>
<ul class="dropdown-menu opt-group">
<li class="opt active versions"><a href="#">v1.2.1</a></li>
<li class="opt versions"><a href="#">v1.1.0</a></li>
<li class="opt versions"><a href="#">v1.0.0</a></li>
<li class="opt versions"><a href="#">v0.12.1</a></li>
<li class="opt versions"><a href="#">v0.11.0</a></li>
<li class="opt versions"><a href="#">master</a></li>
</ul>
</div><script type="text/javascript" src='../_static/js/options.js'></script><!-- START - OS Menu --><div class="btn-group opt-group" role="group">
<button type="button" class="btn btn-default opt active platforms">Linux</button>
<button type="button" class="btn btn-default opt platforms">MacOS</button>
<button type="button" class="btn btn-default opt platforms">Windows</button>
<button type="button" class="btn btn-default opt platforms">Cloud</button>
<button type="button" class="btn btn-default opt platforms">Devices</button>
</div><!-- START - Language Menu --><div class="linux macos windows">
<div class="btn-group opt-group" role="group">
<button type="button" class="btn btn-default opt active languages">Python</button>
<button type="button" class="btn btn-default opt languages">Scala</button>
<button type="button" class="btn btn-default opt languages">R</button>
<button type="button" class="btn btn-default opt languages">Julia</button>
<button type="button" class="btn btn-default opt languages">Perl</button>
<button type="button" class="btn btn-default opt languages">Cpp</button>
</div>
</div><!-- No CPU GPU for other Devices -->
<div class="linux macos windows cloud">
<div class="btn-group opt-group" role="group">
<button type="button" class="btn btn-default processors opt active">CPU</button>
<button type="button" class="btn btn-default processors opt">GPU</button>
</div>
</div><!-- other devices -->
<div class="devices">
<div class="btn-group opt-group" role="group">
<button type="button" class="btn btn-default iots opt active">Raspberry Pi</button>
<button type="button" class="btn btn-default iots opt">NVIDIA Jetson</button>
</div>
</div><!-- Linux Python GPU Options --><div class="linux macos windows">
<div class="python">
<div class="cpu gpu">
<div class="btn-group opt-group" role="group">
<button type="button" class="btn btn-default environs opt active">Pip</button>
<button type="button" class="btn btn-default environs opt">Virtualenv</button>
<button type="button" class="btn btn-default environs opt">Docker</button>
<button type="button" class="btn btn-default environs opt">Build from Source</button>
</div>
</div>
</div>
</div><!-- END - Main Menu --><!-- START - Linux Python CPU Installation Instructions --><div class="linux">
<div class="python">
<div class="cpu"><p>The following installation instructions have been tested on Ubuntu 14.04 and 16.04.</p>
<div class="pip">
<br/><p><strong>Step 1</strong> Install prerequisites - wget and latest pip.</p>
<p>Installing <em>MXNet</em> with pip requires a latest version of <code class="docutils literal"><span class="pre">pip</span></code>. Install the latest version of <code class="docutils literal"><span class="pre">pip</span></code> by issuing the following command in the terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get update
$ sudo apt-get install -y wget python gcc
$ wget https://bootstrap.pypa.io/get-pip.py <span class="o">&amp;&amp;</span> sudo python get-pip.py
</pre></div>
</div>
<div class="v1-2-1"><p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl
</pre></div>
</div>
</div> <!-- End of v1-2-1 --><div class="v1-1-0"><p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl<span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl<span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For MXNet 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl<span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For MXNet 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl<span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl<span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet --pre
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-mkl --pre
</pre></div>
</div>
</div> <!-- End of master--></div> <!-- End of pip --><div class="virtualenv">
<br/><p><strong>Step 1</strong> Install virtualenv for Ubuntu.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get update
$ sudo apt-get install -y python-dev python-virtualenv
</pre></div>
</div>
<p><strong>Step 2</strong> Create and activate virtualenv environment for MXNet.</p>
<p>Following command creates a virtualenv environment at <code class="docutils literal"><span class="pre">~/mxnet</span></code> directory. However, you can choose any directory by replacing <code class="docutils literal"><span class="pre">~/mxnet</span></code> with a directory of your choice.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ virtualenv --system-site-packages ~/mxnet
</pre></div>
</div>
<p>Activate the virtualenv environment created for <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> ~/mxnet/bin/activate
</pre></div>
</div>
<p>After activating the environment, you should see the prompt as below.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$
</pre></div>
</div>
<p><strong>Step 3</strong> Install MXNet in the active virtualenv environment.</p>
<p>Installing <em>MXNet</em> with pip requires a latest version of <code class="docutils literal"><span class="pre">pip</span></code>. Install the latest version of <code class="docutils literal"><span class="pre">pip</span></code> by issuing the following command.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install --upgrade pip
</pre></div>
</div>
<div class="v1-2-1"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet
</pre></div>
</div>
</div> <!-- End of v1-2-1--><div class="v1-1-0"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For <em>MXNet</em> 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet --pre
</pre></div>
</div>
</div> <!-- End of master--><p><strong>Step 4</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 5</strong> Validate the installation by running simple <em>MXNet</em> code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Note</strong> You can read more about virtualenv <a class="reference external" href="https://virtualenv.pypa.io/en/stable/userguide/">here</a>.</p>
</div> <!-- END of virtualenv --><div class="docker">
<br/><p>Docker images with <em>MXNet</em> are available at <a class="reference external" href="https://hub.docker.com/r/mxnet/">Docker Hub</a>.</p>
<p><strong>Step 1</strong> Install Docker on your machine by following the <a class="reference external" href="https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository">docker installation instructions</a>.</p>
<p><em>Note</em> - You can install Community Edition (CE) to get started with <em>MXNet</em>.</p>
<p><strong>Step 2</strong> [Optional] Post installation steps to manage Docker as a non-root user.</p>
<p>Follow the four steps in this <a class="reference external" href="https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user">docker documentation</a> to allow managing docker containers without <em>sudo</em>.</p>
<p>If you skip this step, you need to use <em>sudo</em> each time you invoke Docker.</p>
<p><strong>Step 3</strong> Pull the MXNet docker image.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull mxnet/python <span class="c1"># Use sudo if you skip Step 2</span>
</pre></div>
</div>
<p>You can list docker images to see if mxnet/python docker image pull was successful.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker images <span class="c1"># Use sudo if you skip Step 2</span>
REPOSITORY TAG IMAGE ID CREATED SIZE
mxnet/python latest 00d026968b3c <span class="m">3</span> weeks ago <span class="m">1</span>.41 GB
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div> <!-- END of docker --><div class="build-from-source">
<br/><p>Building <em>MXNet</em> from source is a 2 step process.</p>
<ol class="simple">
<li>Build the <em>MXNet</em> core shared library, <code class="docutils literal"><span class="pre">libmxnet.so</span></code>, from the C++ sources.</li>
<li>Build the language specific bindings. Example - Python bindings, Scala bindings.</li>
</ol>
<p><strong>Minimum Requirements</strong></p>
<ol class="simple">
<li><a class="reference external" href="https://gcc.gnu.org/gcc-4.8/">GCC 4.8</a> or later to compile C++ 11.</li>
<li><a class="reference external" href="https://www.gnu.org/software/make/">GNU Make</a></li>
</ol>
<p><br/></p>
<p><strong>Build the MXNet core shared library</strong></p>
<p><strong>Step 1</strong> Install build tools and git.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get update
$ sudo apt-get install -y build-essential git
</pre></div>
</div>
<p><strong>Step 2</strong> Install OpenBLAS.</p>
<p><em>MXNet</em> uses <a class="reference external" href="https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms">BLAS</a> and <a class="reference external" href="https://en.wikipedia.org/wiki/LAPACK">LAPACK</a> libraries for accelerated numerical computations on CPU machine. There are several flavors of BLAS/LAPACK libraries - <a class="reference external" href="http://www.openblas.net/">OpenBLAS</a>, <a class="reference external" href="http://math-atlas.sourceforge.net/">ATLAS</a> and <a class="reference external" href="https://software.intel.com/en-us/intel-mkl">MKL</a>. In this step we install OpenBLAS. You can choose to install ATLAS or MKL.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get install -y libopenblas-dev liblapack-dev
</pre></div>
</div>
<p><strong>Step 3</strong> Install OpenCV.</p>
<p><em>MXNet</em> uses <a class="reference external" href="http://opencv.org/">OpenCV</a> for efficient image loading and augmentation operations.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get install -y libopencv-dev
</pre></div>
</div>
<p><strong>Step 4</strong> Download MXNet sources and build MXNet core shared library. You can clone the repository as described in the following code block, or you may try the <a href="download.html">download links</a> for your desired MXNet version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ git clone --recursive https://github.com/apache/incubator-mxnet
$ <span class="nb">cd</span> incubator-mxnet
$ make -j <span class="k">$(</span>nproc<span class="k">)</span> <span class="nv">USE_OPENCV</span><span class="o">=</span><span class="m">1</span> <span class="nv">USE_BLAS</span><span class="o">=</span>openblas
</pre></div>
</div>
<p><em>Note</em> - USE_OPENCV and USE_BLAS are make file flags to set compilation options to use OpenCV and BLAS library. You can explore and use more compilation options in <code class="docutils literal"><span class="pre">make/config.mk</span></code>.</p>
<p><br/></p>
<p><strong>Build the MXNet Python binding</strong></p>
<p><strong>Step 1</strong> Install prerequisites - python, setup-tools, python-pip and libfortran (required for Numpy).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get install -y python-dev python-setuptools python-pip libgfortran3
</pre></div>
</div>
<p><strong>Step 2</strong> Install the MXNet Python binding.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> python
$ pip install -e .
</pre></div>
</div>
<p>Note that the <code class="docutils literal"><span class="pre">-e</span></code> flag is optional. It is equivalent to <code class="docutils literal"><span class="pre">--editable</span></code> and means that if you edit the source files, these changes will be reflected in the package installed.</p>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div><!-- END of build from source -->
</div><!-- END of CPU -->
<!-- END - Linux Python CPU Installation Instructions --><!-- START - Linux Python GPU Installation Instructions --><div class="gpu"><p>The following installation instructions have been tested on Ubuntu 14.04 and 16.04.</p>
<p><strong>Prerequisites</strong></p>
<p>Install the following NVIDIA libraries to setup <em>MXNet</em> with GPU support:</p>
<ol class="simple">
<li>Install CUDA 9.0 following the NVIDIA&#8217;s <a class="reference external" href="http://docs.nvidia.com/cuda/cuda-installation-guide-linux/">installation guide</a>.</li>
<li>Install cuDNN 7 for CUDA 9.0 following the NVIDIA&#8217;s <a class="reference external" href="https://developer.nvidia.com/cudnn">installation guide</a>. You may need to register with NVIDIA for downloading the cuDNN library.</li>
</ol>
<p><strong>Note:</strong> Make sure to add CUDA install path to <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code>.</p>
<p>Example - <em>export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:$LD_LIBRARY_PATH</em></p>
<div class="pip">
<br/><p><strong>Step 1</strong> Install prerequisites - wget and latest pip.</p>
<p>Installing <em>MXNet</em> with pip requires a latest version of <code class="docutils literal"><span class="pre">pip</span></code>. Install the latest version of <code class="docutils literal"><span class="pre">pip</span></code> by issuing the following command in the terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get update
$ sudo apt-get install -y wget python
$ wget https://bootstrap.pypa.io/get-pip.py <span class="o">&amp;&amp;</span> sudo python get-pip.py
</pre></div>
</div>
<div class="v1-2-1"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.2</p>
<p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu92
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90mkl
</pre></div>
</div>
</div> <!-- End of v1-2-1--><div class="v1-1-0"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.1</p>
<p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu91<span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install MXNet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu91mkl<span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.0</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90mkl<span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.0</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For <em>MXNet</em> 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install mxnet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90mkl<span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For <em>MXNet</em> 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90mkl<span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 8.0</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu80<span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Experimental Choice</strong> If You would like to install MXNet with Intel MKL, try the experimental pip package with MKL:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu80mkl<span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--></div> <!-- END of pip --><div class="virtualenv"><p><br/></p>
<p><strong>Step 1</strong> Install virtualenv for Ubuntu.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get update
$ sudo apt-get install -y python-dev python-virtualenv
</pre></div>
</div>
<p><strong>Step 2</strong> Create and activate virtualenv environment for MXNet.</p>
<p>Following command creates a virtualenv environment at <code class="docutils literal"><span class="pre">~/mxnet</span></code> directory. However, you can choose any directory by replacing <code class="docutils literal"><span class="pre">~/mxnet</span></code> with a directory of your choice.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ virtualenv --system-site-packages ~/mxnet
</pre></div>
</div>
<p>Activate the virtualenv environment created for <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> ~/mxnet/bin/activate
</pre></div>
</div>
<p>After activating the environment, you should see the prompt as below.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$
</pre></div>
</div>
<p><strong>Step 3</strong> Install MXNet in the active virtualenv environment.</p>
<p>Installing <em>MXNet</em> with pip requires a latest version of <code class="docutils literal"><span class="pre">pip</span></code>. Install the latest version of <code class="docutils literal"><span class="pre">pip</span></code> by issuing the following command.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install --upgrade pip
</pre></div>
</div>
<div class="v1-2-1"><p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<p>Install <em>MXNet</em> with GPU support using CUDA 9.2:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet-cu92
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v1-2-1--><div class="v1-1-0"><p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<p>Install <em>MXNet</em> with GPU support using CUDA 9.1:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet-cu91<span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p>Install <em>MXNet</em> with GPU support using CUDA 9.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p>Install <em>MXNet</em> with GPU support using CUDA 9.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p>Install <em>MXNet</em> with GPU support using CUDA 8.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet-cu80<span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<p>Install <em>MXNet</em> with GPU support using CUDA 9.2.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet-cu92 --pre
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of master--><p><strong>Step 4</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 5</strong> Validate the installation by running simple <em>MXNet</em> code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Note</strong> You can read more about virtualenv <a class="reference external" href="https://virtualenv.pypa.io/en/stable/userguide/">here</a>.</p>
</div> <!-- END of virtualenv --><div class="docker"><p><br/></p>
<p>Docker images with <em>MXNet</em> are available at <a class="reference external" href="https://hub.docker.com/r/mxnet/">Docker Hub</a>.</p>
<p><strong>Step 1</strong> Install Docker on your machine by following the <a class="reference external" href="https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository">docker installation instructions</a>.</p>
<p><em>Note</em> - You can install Community Edition (CE) to get started with <em>MXNet</em>.</p>
<p><strong>Step 2</strong> [Optional] Post installation steps to manage Docker as a non-root user.</p>
<p>Follow the four steps in this <a class="reference external" href="https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user">docker documentation</a> to allow managing docker containers without <em>sudo</em>.</p>
<p>If you skip this step, you need to use <em>sudo</em> each time you invoke Docker.</p>
<p><strong>Step 3</strong> Install <em>nvidia-docker-plugin</em> following the <a class="reference external" href="https://github.com/NVIDIA/nvidia-docker/wiki/Installation">installation instructions</a>. <em>nvidia-docker-plugin</em> is required to enable the usage of GPUs from the docker containers.</p>
<p><strong>Step 4</strong> Pull the MXNet docker image.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull mxnet/python:gpu <span class="c1"># Use sudo if you skip Step 2</span>
</pre></div>
</div>
<p>You can list docker images to see if mxnet/python docker image pull was successful.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker images <span class="c1"># Use sudo if you skip Step 2</span>
REPOSITORY TAG IMAGE ID CREATED SIZE
mxnet/python gpu 493b2683c269 <span class="m">3</span> weeks ago <span class="m">4</span>.77 GB
</pre></div>
</div>
<p><strong>Step 5</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div> <!-- END of docker --><div class="build-from-source"><p><br/></p>
<p>Building <em>MXNet</em> from source is a 2 step process.</p>
<ol class="simple">
<li>Build the <em>MXNet</em> core shared library, <code class="docutils literal"><span class="pre">libmxnet.so</span></code>, from the C++ sources.</li>
<li>Build the language specific bindings. Example - Python bindings, Scala bindings.</li>
</ol>
<p><strong>Minimum Requirements</strong></p>
<ol class="simple">
<li><a class="reference external" href="https://gcc.gnu.org/gcc-4.8/">GCC 4.8</a> or later to compile C++ 11.</li>
<li><a class="reference external" href="https://www.gnu.org/software/make/">GNU Make</a></li>
</ol>
<p><br/></p>
<p><strong>Build the MXNet core shared library</strong></p>
<p><strong>Step 1</strong> Install build tools and git.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get update
$ sudo apt-get install -y build-essential git
</pre></div>
</div>
<p><strong>Step 2</strong> Install OpenBLAS.</p>
<p><em>MXNet</em> uses <a class="reference external" href="https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms">BLAS</a> and <a class="reference external" href="https://en.wikipedia.org/wiki/LAPACK">LAPACK</a> libraries for accelerated numerical computations on CPU machine. There are several flavors of BLAS/LAPACK libraries - <a class="reference external" href="http://www.openblas.net/">OpenBLAS</a>, <a class="reference external" href="http://math-atlas.sourceforge.net/">ATLAS</a> and <a class="reference external" href="https://software.intel.com/en-us/intel-mkl">MKL</a>. In this step we install OpenBLAS. You can choose to install ATLAS or MKL.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get install -y libopenblas-dev liblapack-dev
</pre></div>
</div>
<p><strong>Step 3</strong> Install OpenCV.</p>
<p><em>MXNet</em> uses <a class="reference external" href="http://opencv.org/">OpenCV</a> for efficient image loading and augmentation operations.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get install -y libopencv-dev
</pre></div>
</div>
<p><strong>Step 4</strong> Download MXNet sources and build MXNet core shared library. You can clone the repository as described in the following code block, or you may try the <a href="download.html">download links</a> for your desired MXNet version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ git clone --recursive https://github.com/apache/incubator-mxnet
$ <span class="nb">cd</span> incubator-mxnet
$ make -j <span class="k">$(</span>nproc<span class="k">)</span> <span class="nv">USE_OPENCV</span><span class="o">=</span><span class="m">1</span> <span class="nv">USE_BLAS</span><span class="o">=</span>openblas <span class="nv">USE_CUDA</span><span class="o">=</span><span class="m">1</span> <span class="nv">USE_CUDA_PATH</span><span class="o">=</span>/usr/local/cuda <span class="nv">USE_CUDNN</span><span class="o">=</span><span class="m">1</span>
</pre></div>
</div>
<p><em>Note</em> - USE_OPENCV, USE_BLAS, USE_CUDA, USE_CUDA_PATH AND USE_CUDNN are make file flags to set compilation options to use OpenCV, OpenBLAS, CUDA and cuDNN libraries. You can explore and use more compilation options in <code class="docutils literal"><span class="pre">make/config.mk</span></code>. Make sure to set USE_CUDA_PATH to right CUDA installation path. In most cases it is - <em>/usr/local/cuda</em>.</p>
<p><br/></p>
<p><strong>Install the MXNet Python binding</strong></p>
<p><strong>Step 1</strong> Install prerequisites - python, setup-tools, python-pip and libfortran (required for Numpy)..</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ sudo apt-get install -y python-dev python-setuptools python-pip libgfortran3
</pre></div>
</div>
<p><strong>Step 2</strong> Install the MXNet Python binding.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> python
$ pip install -e .
</pre></div>
</div>
<p>Note that the <code class="docutils literal"><span class="pre">-e</span></code> flag is optional. It is equivalent to <code class="docutils literal"><span class="pre">--editable</span></code> and means that if you edit the source files, these changes will be reflected in the package installed.</p>
<p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>sudo apt-get install graphviz
pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div> <!-- END of build from source -->
</div> <!-- END of GPU -->
</div> <!-- END of Python -->
<!-- END - Linux Python GPU Installation Instructions --><div class="r">
<div class="cpu"><p>The default version of R that is installed with <code class="docutils literal"><span class="pre">apt-get</span></code> is insufficient. You will need to first <a class="reference external" href="/versions/1.3.1/install/ubuntu_setup.html#install-the-mxnet-package-for-r">install R v3.4.4+ and build MXNet from source</a>.</p>
<p>After you have setup R v3.4.4+ and MXNet, you can build and install the MXNet R bindings with the following, assuming that <code class="docutils literal"><span class="pre">incubator-mxnet</span></code> is the source directory you used to build MXNet as follows:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> incubator-mxnet
$ make rpkg
</pre></div>
</div>
</div> <!-- END of CPU --><div class="gpu"><p>The default version of R that is installed with <code class="docutils literal"><span class="pre">apt-get</span></code> is insufficient. You will need to first <a class="reference external" href="/versions/1.3.1/install/ubuntu_setup.html#install-the-mxnet-package-for-r">install R v3.4.4+ and build MXNet from source</a>.</p>
<p>After you have setup R v3.4.4+ and MXNet, you can build and install the MXNet R bindings with the following, assuming that <code class="docutils literal"><span class="pre">incubator-mxnet</span></code> is the source directory you used to build MXNet as follows:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> incubator-mxnet
$ make rpkg
</pre></div>
</div>
</div> <!-- END of GPU -->
</div> <!-- END of R --><div class="scala">
<div class="gpu"><p>You can use the Maven packages defined in the following <code class="docutils literal"><span class="pre">dependency</span></code> to include MXNet in your Scala project. Please refer to the <a href="scala_setup.html">MXNet-Scala setup guide</a> for a detailed set of instructions to help you with the setup process.</p>
<p><a href="https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-linux-x86_64-gpu"><img src="https://img.shields.io/badge/org.apache.mxnet-linux gpu-green.svg" alt="maven badge"/></a></p>
<div class="highlight-html"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">dependency</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">groupId</span><span class="p">&gt;</span>org.apache.mxnet<span class="p">&lt;/</span><span class="nt">groupId</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">artifactId</span><span class="p">&gt;</span>mxnet-full_2.11-linux-x86_64-gpu<span class="p">&lt;/</span><span class="nt">artifactId</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">dependency</span><span class="p">&gt;</span>
</pre></div>
</div>
<p><br></p>
</div> <!-- End of gpu --><div class="cpu"><p>You can use the Maven packages defined in the following <code class="docutils literal"><span class="pre">dependency</span></code> to include MXNet in your Scala project. Please refer to the <a href="scala_setup.html">MXNet-Scala setup guide</a> for a detailed set of instructions to help you with the setup process.</p>
<p><a href="https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu"><img src="https://img.shields.io/badge/org.apache.mxnet-linux cpu-green.svg" alt="maven badge"/></a></p>
<div class="highlight-html"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">dependency</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">groupId</span><span class="p">&gt;</span>org.apache.mxnet<span class="p">&lt;/</span><span class="nt">groupId</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">artifactId</span><span class="p">&gt;</span>mxnet-full_2.11-linux-x86_64-cpu<span class="p">&lt;/</span><span class="nt">artifactId</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">dependency</span><span class="p">&gt;</span>
</pre></div>
</div>
<p><br></p>
</div> <!-- End of cpu -->
</div> <!-- End of scala --><div class="julia perl">
<div class="cpu gpu"><p>Follow the installation instructions <a class="reference internal" href="ubuntu_setup.html"><span class="doc">in this guide</span></a> to set up MXNet.</p>
</div> <!-- End of cpu gpu -->
</div> <!-- End of julia perl --><div class="cpp">
<div class="cpu gpu">
<p> To build the C++ package, please refer to <a href="build_from_source.html#build-the-c-package">this guide</a>. </p>
<br/>
</div> <!-- End of cpu gpu -->
</div> <!-- END - C++-->
</div> <!-- END - Linux --><!-- START - MacOS Python CPU Installation Instructions --><div class="macos">
<div class="python">
<div class="cpu"><p>The following installation instructions have been tested on OSX Sierra and El Capitan.</p>
<div class="pip">
<br/><p><strong>Step 1</strong> Install prerequisites - Homebrew, python development tools.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="c1"># Install Homebrew</span>
$ /usr/bin/ruby -e <span class="s2">&quot;</span><span class="k">$(</span>curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install<span class="k">)</span><span class="s2">&quot;</span>
$ <span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/usr/local/bin:/usr/local/sbin:<span class="nv">$PATH</span>
<span class="c1"># Install python development tools - python2.7, pip, python-setuptools</span>
$ brew install python
</pre></div>
</div>
<p><strong>Step 2</strong> Install MXNet with OpenBLAS acceleration.</p>
<p>Installing <em>MXNet</em> with pip requires a latest version of <code class="docutils literal"><span class="pre">pip</span></code>. Install the latest version of <code class="docutils literal"><span class="pre">pip</span></code> by issuing the following command.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install --upgrade pip
$ pip install --upgrade setuptools
</pre></div>
</div>
<div class="v1-2-1"><p>Then use pip to install MXNet:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet
</pre></div>
</div>
</div> <!-- End of v1-2-1 --><div class="v1-1-0"><p>Then use pip to install MXNet:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p>Then use pip to install MXNet:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p>Then use pip to install MXNet:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">=</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For MXNet 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">=</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p>Then use pip to install MXNet:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p>Then use pip to install MXNet:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet --pre
</pre></div>
</div>
</div> <!-- End of master--><p><strong>Step 3</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ brew install graphviz
$ pip install graphviz
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div> <!-- END of pip --><div class="virtualenv">
<br/><p><strong>Step 1</strong> Install prerequisites - Homebrew, python development tools.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="c1"># Install Homebrew</span>
$ /usr/bin/ruby -e <span class="s2">&quot;</span><span class="k">$(</span>curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install<span class="k">)</span><span class="s2">&quot;</span>
$ <span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/usr/local/bin:/usr/local/sbin:<span class="nv">$PATH</span>
<span class="c1"># Install python development tools - python2.7, pip, python-setuptools</span>
$ brew install python
</pre></div>
</div>
<p><strong>Step 2</strong> Install virtualenv for macOS.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install virtualenv
</pre></div>
</div>
<p><strong>Step 3</strong> Create and activate virtualenv environment for MXNet.</p>
<p>Following command creates a virtualenv environment at <code class="docutils literal"><span class="pre">~/mxnet</span></code> directory. However, you can choose any directory by replacing <code class="docutils literal"><span class="pre">~/mxnet</span></code> with a directory of your choice.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ virtualenv --system-site-packages ~/mxnet
</pre></div>
</div>
<p>Activate the virtualenv environment created for <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> ~/mxnet/bin/activate
</pre></div>
</div>
<p>After activating the environment, you should see the prompt as below.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$
</pre></div>
</div>
<p><strong>Step 4</strong> Install MXNet in the active virtualenv environment.</p>
<p>Installing <em>MXNet</em> with pip requires a latest version of <code class="docutils literal"><span class="pre">pip</span></code>. Install the latest version of <code class="docutils literal"><span class="pre">pip</span></code> by issuing the following command.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install --upgrade pip
<span class="o">(</span>mxnet<span class="o">)</span>$ pip install --upgrade setuptools
</pre></div>
</div>
<div class="v1-2-1"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet
</pre></div>
</div>
</div> <!-- End of v1-2-1--><div class="v1-1-0"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For <em>MXNet</em> 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p>Install <em>MXNet</em> with OpenBLAS acceleration.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$ pip install mxnet --pre
</pre></div>
</div>
</div> <!-- End of master--><p><strong>Step 5</strong> Install <a class="reference external" href="http://www.graphviz.org/">Graphviz</a>. (Optional, needed for graph visualization using <code class="docutils literal"><span class="pre">mxnet.viz</span></code> package).</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ brew install graphviz
<span class="o">(</span>mxnet<span class="o">)</span>$ pip install graphviz
</pre></div>
</div>
<p><strong>Step 6</strong> Validate the installation by running simple <em>MXNet</em> code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
<p><strong>Note</strong> You can read more about virtualenv <a class="reference external" href="https://virtualenv.pypa.io/en/stable/userguide/">here</a>.</p>
</div> <!-- End of virtualenv --><div class="docker">
<br/><p>Docker images with <em>MXNet</em> are available at <a class="reference external" href="https://hub.docker.com/r/mxnet/">Docker Hub</a>.</p>
<p><strong>Step 1</strong> Install Docker on your machine by following the <a class="reference external" href="https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac">docker installation instructions</a>.</p>
<p><em>Note</em> - You can install Community Edition (CE) to get started with <em>MXNet</em>.</p>
<p><strong>Step 2</strong> Pull the MXNet docker image.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker pull mxnet/python
</pre></div>
</div>
<p>You can list docker images to see if mxnet/python docker image pull was successful.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mxnet/python latest 00d026968b3c <span class="m">3</span> weeks ago <span class="m">1</span>.41 GB
</pre></div>
</div>
<p><strong>Step 4</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div> <!-- END of docker --><div class="build-from-source">
<br/><p><strong>Prerequisites</strong></p>
<p>If not already installed, <a class="reference external" href="https://developer.apple.com/xcode/">download and install Xcode</a> (or <a class="reference external" href="https://itunes.apple.com/us/app/xcode/id497799835">insall it from the App Store</a>) for macOS. <a class="reference external" href="https://en.wikipedia.org/wiki/Xcode">Xcode</a> is an integrated development environment for macOS containing a suite of software development tools like C/C++ compilers, BLAS library and more.</p>
<p><br/></p>
<p>Building <em>MXNet</em> from source is a 2 step process.</p>
<ol class="simple">
<li>Build the <em>MXNet</em> core shared library, <code class="docutils literal"><span class="pre">libmxnet.so</span></code>, from the C++ sources.</li>
<li>Build the language specific bindings. Example - Python bindings, Scala bindings.</li>
</ol>
<p>Make sure you have installed Xcode before proceeding further.</p>
<p><br/></p>
<p>All the instructions to build <em>MXNet</em> core shared library and <em>MXNet</em> Python bindings are compiled as one helper <em>bash</em> script. You can use <a class="reference external" href="https://raw.githubusercontent.com/dmlc/mxnet/master/setup-utils/install-mxnet-osx-python.sh">this bash script</a> to build <em>MXNet</em> for Python, from source, on macOS.</p>
<p><strong>Step 1</strong> Download the bash script for building MXNet from source.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ curl -O https://raw.githubusercontent.com/dmlc/mxnet/master/setup-utils/install-mxnet-osx-python.sh
</pre></div>
</div>
<p><strong>Step 2</strong> Run the script to get latest MXNet source and build.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="c1"># Make the script executable</span>
$ chmod <span class="m">744</span> install-mxnet-osx-python.sh
<span class="c1"># Run the script. It takes around 5 mins.</span>
$ bash install-mxnet-osx-python.sh
</pre></div>
</div>
<p><strong>Step 3</strong> Validate the installation by running simple MXNet code described <a class="reference external" href="#validate-mxnet-installation">here</a>.</p>
</div> <!-- END of build from source -->
</div> <!-- END of CPU --><!-- START - Mac OS Python GPU Installation Instructions -->
<div class="gpu">
<div class="pip virtualenv docker">
</br><p>Try the <strong>Build from Source</strong> option for now.</p>
</div><div class="build-from-source"><p><strong>Step 1</strong> Install prerequisites - Homebrew, python development tools.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="c1"># Install Homebrew</span>
$ /usr/bin/ruby -e <span class="s2">&quot;</span><span class="k">$(</span>curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install<span class="k">)</span><span class="s2">&quot;</span>
$ <span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/usr/local/bin:/usr/local/sbin:<span class="nv">$PATH</span>
<span class="c1"># Install python development tools - python2.7, pip, python-setuptools</span>
$ brew install python pkg-config graphviz
</pre></div>
</div>
<p><strong>Step 2</strong> Install optional components - OpenCV</p>
<p>If you want to use OpenCV you should install it first, then build MXNet with the <code class="docutils literal"><span class="pre">USE_OPENCV=1</span></code> option in the later steps.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>brew tap homebrew/science
brew install opencv
</pre></div>
</div>
<p><strong>Step 3</strong> Install CUDA and cuDNN</p>
<p>The following instructions are for CUDA 9.1 and cuDNN 7 for macOS 10.12+ and a CUDA-capable GPU. They summarize confirmed successful builds in <a class="reference external" href="https://github.com/apache/incubator-mxnet/issues/9217">#9217</a>.
Alternatively, you may follow the <a class="reference external" href="https://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html">CUDA installation instructions for macOS</a>.</p>
<ol class="simple">
<li><a class="reference external" href="https://developer.apple.com/download/more/">Download Xcode 8.3.3 from Apple</a>. This is the version <a class="reference external" href="https://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html">NVIDIA specifies in its instructions for macOS</a>. Unzip and rename to <code class="docutils literal"><span class="pre">Xcode8.3.3.app</span></code>.</li>
<li>Run <code class="docutils literal"><span class="pre">sudo</span> <span class="pre">xcode-select</span> <span class="pre">-s</span> <span class="pre">/Applications/Xcode8.3.3.app</span></code> or to wherever you have placed Xcode.</li>
<li>Run <code class="docutils literal"><span class="pre">xcode-select</span> <span class="pre">--install</span></code> to install all command line tools, compilers, etc.</li>
<li>Run <code class="docutils literal"><span class="pre">sudo</span> <span class="pre">xcodebuild</span> <span class="pre">-license</span> <span class="pre">accept</span></code> to accept Xcode&#8217;s licensing terms.</li>
<li>Install CUDA for macOS. Specific steps are provided in NVIDIA&#8217;s <a class="reference external" href="https://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html#installation">CUDA installation instructions</a>.</li>
<li><a class="reference external" href="http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#download-mac">Download</a> and <a class="reference external" href="http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installmac">install</a> cuDNN for macOS. You will need to <a class="reference external" href="https://developer.nvidia.com/accelerated-computing-developer">create a free developer account</a> with NVIDIA prior to getting the download link.</li>
</ol>
<p><strong>Step 4</strong> Build MXNet</p>
<ol>
<li><p class="first">Run <code class="docutils literal"><span class="pre">git</span> <span class="pre">clone</span> <span class="pre">--recursive</span> <span class="pre">https://github.com/apache/incubator-mxnet.git</span> <span class="pre">mxnet</span></code> to get the latest version.</p>
</li>
<li><p class="first">Run <code class="docutils literal"><span class="pre">cd</span> <span class="pre">mxnet</span></code>.</p>
</li>
<li><p class="first">Edit the <code class="docutils literal"><span class="pre">make/osx.mk</span></code> file to set the following parameters:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">USE_CUDA</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">USE_CUDA_PATH</span> <span class="o">=</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">cuda</span>
<span class="n">USE_CUDNN</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">USE_OPENCV</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># set to 1 if you want to build with OpenCV</span>
</pre></div>
</div>
</li>
<li><p class="first">Copy the <code class="docutils literal"><span class="pre">make/osx.mk</span></code> to <code class="docutils literal"><span class="pre">config.mk</span></code></p>
</li>
<li><p class="first">Run <code class="docutils literal"><span class="pre">make</span></code>. If you previously attempted to compile you might want to do <code class="docutils literal"><span class="pre">make</span> <span class="pre">clean_all</span></code> first. You can also run <code class="docutils literal"><span class="pre">make</span> <span class="pre">-j</span></code> with the number of processors you have to compile with multithreading. There&#8217;ll be plenty of warnings, but there should be no errors.</p>
</li>
<li><p class="first">Once finished, you should have a file called <code class="docutils literal"><span class="pre">libmxnet.so</span></code> in <code class="docutils literal"><span class="pre">lib/</span></code>.</p>
</li>
<li><p class="first">Do <code class="docutils literal"><span class="pre">cd</span> <span class="pre">python</span></code>.</p>
</li>
<li><p class="first">Run <code class="docutils literal"><span class="pre">sudo</span> <span class="pre">pip</span> <span class="pre">install</span> <span class="pre">-e</span> <span class="pre">.</span></code> <strong>Note</strong>: the <code class="docutils literal"><span class="pre">.</span></code> is part of the command.</p>
</li>
</ol>
</div> <!-- END of build from source -->
</div> <!-- END of GPU -->
</div> <!-- END of Python --><!-- START - MacOS R CPU Installation Instructions --><div class="r">
<div class="cpu"><p>Install the latest version (3.5.1+) of R from <a class="reference external" href="https://cran.r-project.org/bin/macosx/">CRAN</a>.
You can <a class="reference external" href="/versions/1.3.1/install/osx_setup.html#install-the-mxnet-package-for-r">build MXNet-R from source</a>, or you can use a pre-built binary:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">cran</span> <span class="o">&lt;-</span> <span class="nf">getOption</span><span class="p">(</span><span class="s">&quot;repos&quot;</span><span class="p">)</span>
<span class="n">cran[</span><span class="s">&quot;dmlc&quot;</span><span class="n">]</span> <span class="o">&lt;-</span> <span class="s">&quot;https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/&quot;</span>
<span class="nf">options</span><span class="p">(</span><span class="n">repos</span> <span class="o">=</span> <span class="n">cran</span><span class="p">)</span>
<span class="nf">install.packages</span><span class="p">(</span><span class="s">&quot;mxnet&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div> <!-- END of CPU --><div class="gpu"><p>Will be available soon.</p>
</div> <!-- END of GPU -->
</div> <!-- END of R --><div class="scala">
<div class="cpu"><p>You can use the Maven packages defined in the following <code class="docutils literal"><span class="pre">dependency</span></code> to include MXNet in your Scala project. Please refer to the <a href="scala_setup.html">MXNet-Scala setup guide</a> for a detailed set of instructions to help you with the setup process.</p>
<p><a href="https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu"><img src="https://img.shields.io/badge/org.apache.mxnet-mac cpu-green.svg" alt="maven badge"/></a></p>
<div class="highlight-html"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">dependency</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">groupId</span><span class="p">&gt;</span>org.apache.mxnet<span class="p">&lt;/</span><span class="nt">groupId</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">artifactId</span><span class="p">&gt;</span>mxnet-full_2.11-osx-x86_64-cpu<span class="p">&lt;/</span><span class="nt">artifactId</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">dependency</span><span class="p">&gt;</span>
</pre></div>
</div>
<p><br></p>
</div> <!-- End of cpu -->
<div class="gpu"><p>Not available at this time. <br></p>
</div>
</div> <!-- End of scala --><div class="julia perl">
<div class="cpu gpu"><p>Follow the installation instructions <a class="reference internal" href="osx_setup.html"><span class="doc">in this guide</span></a> to set up MXNet.</p>
</div> <!-- End of cpu gpu -->
</div> <!-- End of julia perl --><div class="cpp">
<p>To build the C++ package, please refer to <a href="build_from_source.html#build-the-c-package">this guide</a>.</p>
<br/>
</div>
</div> <!-- END - Mac OS --><div class="windows">
<div class="python">
<div class="cpu">
<div class="pip"><p><br/></p>
<p><strong>Step 1</strong> Install Python.</p>
<p><a class="reference external" href="https://www.anaconda.com/download/">Anaconda</a> is recommended.</p>
<div class="v1-2-1"><p><strong>Step 2</strong> Install <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet
</pre></div>
</div>
</div> <!-- End of v1-2-1--><div class="v1-1-0"><p><strong>Step 2</strong> Install <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p><strong>Step 2</strong> Install <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p><strong>Step 2</strong> Install <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>For <em>MXNet</em> 0.12.0 -</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p><strong>Step 2</strong> Install <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install <span class="nv">mxnet</span><span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p><strong>Step 2</strong> Install <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet --pre
</pre></div>
</div>
</div> <!-- End of master--></div> <!-- End of pip --><div class="virtualenv docker build-from-source"><p>Follow the installation instructions <a class="reference internal" href="windows_setup.html"><span class="doc">in this guide</span></a> to set up MXNet.</p>
</div> <!-- End of virtualenv docker build-from-source -->
</div> <!-- End of CPU --><div class="gpu">
<div class="pip"><p><br/></p>
<p><strong>Step 1</strong> Install Python.</p>
<p><a class="reference external" href="https://www.anaconda.com/download/">Anaconda</a> is recommended.</p>
<div class="v1-2-1"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.2.</p>
<p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu92
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v1-2-1--><div class="v1-1-0"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.1.</p>
<p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu91<span class="o">==</span><span class="m">1</span>.1.0
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of v1-1-0--><div class="v1-0-0"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">1</span>.0.0
</pre></div>
</div>
</div> <!-- End of v1-0-0--><div class="v0-12-1"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">0</span>.12.1
</pre></div>
</div>
<p>Install <em>MXNet</em> 0.12.0 with GPU support using CUDA 9.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu90<span class="o">==</span><span class="m">0</span>.12.0
</pre></div>
</div>
</div> <!-- End of v0-12-1--><div class="v0-11-0"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 8.0.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu80<span class="o">==</span><span class="m">0</span>.11.0
</pre></div>
</div>
</div> <!-- End of v0-11-0--><div class="master"><p><strong>Step 2</strong> Install <em>MXNet</em> with GPU support using CUDA 9.2.</p>
<p><strong>Important</strong>: Make sure your installed CUDA version matches the CUDA version in the pip package.
Check your CUDA version with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>nvcc --version
</pre></div>
</div>
<p>You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pip install mxnet-cu92 --pre
</pre></div>
</div>
<p>Refer to <a class="reference external" href="https://pypi.org/project/mxnet/">pypi for older packages</a>.</p>
</div> <!-- End of master--><p>Refer to <a class="reference external" href="https://github.com/apache/incubator-mxnet/issues/8671">#8671</a> for status on CUDA 9.1 support.</p>
</div>
<div class="build-from-source">
<br/><p>We provide both options to build and install MXNet yourself using <a class="reference external" href="https://www.visualstudio.com/downloads/">Microsoft Visual Studio 2017</a>, and <a class="reference external" href="https://www.visualstudio.com/vs/older-downloads/">Microsoft Visual Studio 2015</a>.</p>
<p><strong>Option 1</strong></p>
<p>To build and install MXNet yourself using <a class="reference external" href="https://www.visualstudio.com/downloads/">Microsoft Visual Studio 2017</a>, you need the following dependencies. Install the required dependencies:</p>
<ol class="simple">
<li>If <a class="reference external" href="https://www.visualstudio.com/downloads/">Microsoft Visual Studio 2017</a> is not already installed, download and install it. You can download and install the free community edition.</li>
<li>Download and install <a class="reference external" href="https://cmake.org/files/v3.11/cmake-3.11.0-rc4-win64-x64.msi">CMake</a> if it is not already installed.</li>
<li>Download and install <a class="reference external" href="https://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.4.1/opencv-3.4.1-vc14_vc15.exe/download">OpenCV</a>.</li>
<li>Unzip the OpenCV package.</li>
<li>Set the environment variable <code class="docutils literal"><span class="pre">OpenCV_DIR</span></code> to point to the <code class="docutils literal"><span class="pre">OpenCV</span> <span class="pre">build</span> <span class="pre">directory</span></code> (e.g., <code class="docutils literal"><span class="pre">OpenCV_DIR</span> <span class="pre">=</span> <span class="pre">C:\utils\opencv\build</span></code>).</li>
<li>If you don’t have the Intel Math Kernel Library (MKL) installed, download and install <a class="reference external" href="https://sourceforge.net/projects/openblas/files/v0.2.20/OpenBLAS%200.2.20%20version.zip/download">OpenBlas</a>.</li>
<li>Set the environment variable <code class="docutils literal"><span class="pre">OpenBLAS_HOME</span></code> to point to the <code class="docutils literal"><span class="pre">OpenBLAS</span></code> directory that contains the <code class="docutils literal"><span class="pre">include</span></code> and <code class="docutils literal"><span class="pre">lib</span></code> directories (e.g., <code class="docutils literal"><span class="pre">OpenBLAS_HOME</span> <span class="pre">=</span> <span class="pre">C:\utils\OpenBLAS</span></code>).</li>
<li>Download and install CUDA: Install <a class="reference external" href="https://developer.nvidia.com/cuda-downloads?target_os=Windows&amp;target_arch=x86_64&amp;target_version=10&amp;target_type=exelocal">CUDA</a>, and Download the base installer (e.g., <code class="docutils literal"><span class="pre">cuda_9.1.85_win10.exe</span></code>).</li>
<li>Download and install cuDNN. To get access to the download link, register as an NVIDIA community user. Then Follow the <a class="reference external" href="http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#install-windows">link</a> to install the cuDNN.</li>
<li>Download and install <a class="reference external" href="https://git-for-windows.github.io/">git</a>.</li>
</ol>
<p>After you have installed all of the required dependencies, build the MXNet source code:</p>
<ol class="simple">
<li>Start <code class="docutils literal"><span class="pre">cmd</span></code> in windows.</li>
<li>Download the MXNet source code from GitHub by using following command:</li>
</ol>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">C</span><span class="o">:</span><span class="n">\</span>
<span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="o">://</span><span class="n">github.com</span><span class="o">/</span><span class="n">apache</span><span class="o">/</span><span class="n">incubator</span><span class="o">-</span><span class="n">mxnet.git</span> <span class="o">--</span><span class="n">recursive</span>
</pre></div>
</div>
<ol class="simple">
<li>Follow <a class="reference external" href="https://docs.microsoft.com/en-us/visualstudio/install/modify-visual-studio">this link</a> to modify <code class="docutils literal"><span class="pre">Individual</span> <span class="pre">components</span></code>, and check <code class="docutils literal"><span class="pre">VC++</span> <span class="pre">2017</span> <span class="pre">version</span> <span class="pre">15.4</span> <span class="pre">v14.11</span> <span class="pre">toolset</span></code>, and click <code class="docutils literal"><span class="pre">Modify</span></code>.</li>
<li>Change the version of the Visual studio 2017 to v14.11 using the following command (by default the VS2017 is installed in the following path):</li>
</ol>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="s">&quot;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat&quot;</span> <span class="o">-</span><span class="n">vcvars_ver</span><span class="o">=</span><span class="m">14.11</span>
</pre></div>
</div>
<ol class="simple">
<li>Create a build dir using the following command and go to the directory, for example:</li>
</ol>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">mkdir</span> <span class="n">C</span><span class="o">:</span><span class="n">\build</span>
<span class="n">cd</span> <span class="n">C</span><span class="o">:</span><span class="n">\build</span>
</pre></div>
</div>
<ol class="simple">
<li>CMake the MXNet source code by using following command:</li>
</ol>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="o">-</span><span class="n">G</span> <span class="s">&quot;Visual Studio 15 2017 Win64&quot;</span> <span class="o">-</span><span class="bp">T</span> <span class="n">cuda</span><span class="o">=</span><span class="m">9.1</span><span class="p">,</span><span class="n">host</span><span class="o">=</span><span class="n">x64</span> <span class="o">-</span><span class="n">DUSE_CUDA</span><span class="o">=</span><span class="m">1</span> <span class="o">-</span><span class="n">DUSE_CUDNN</span><span class="o">=</span><span class="m">1</span> <span class="o">-</span><span class="n">DUSE_NVRTC</span><span class="o">=</span><span class="m">1</span> <span class="o">-</span><span class="n">DUSE_OPENCV</span><span class="o">=</span><span class="m">1</span> <span class="o">-</span><span class="n">DUSE_OPENMP</span><span class="o">=</span><span class="m">1</span> <span class="o">-</span><span class="n">DUSE_BLAS</span><span class="o">=</span><span class="n">open</span> <span class="o">-</span><span class="n">DUSE_LAPACK</span><span class="o">=</span><span class="m">1</span> <span class="o">-</span><span class="n">DUSE_DIST_KVSTORE</span><span class="o">=</span><span class="m">0</span> <span class="o">-</span><span class="n">DCUDA_ARCH_LIST</span><span class="o">=</span><span class="n">Common</span> <span class="o">-</span><span class="n">DCUDA_TOOLSET</span><span class="o">=</span><span class="m">9.1</span> <span class="o">-</span><span class="n">DCUDNN_INCLUDE</span><span class="o">=</span><span class="n">C</span><span class="o">:</span><span class="n">\cuda\include</span> <span class="o">-</span><span class="n">DCUDNN_LIBRARY</span><span class="o">=</span><span class="n">C</span><span class="o">:</span><span class="n">\cuda\lib\x64\cudnn.lib</span> <span class="s">&quot;C:\incubator-mxnet&quot;</span>
</pre></div>
</div>
<p>NOTE: make sure the DCUDNN_INCLUDE and DCUDNN_LIBRARY pointing to the “include” and “cudnn.lib” of your CUDA installed location, and the <code class="docutils literal"><span class="pre">C:\incubator-mxnet</span></code> is the location of the source code you just git in the previous step</p>
<ol class="simple">
<li>After the CMake successfully completed, compile the the MXNet source code by using following command:</li>
</ol>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">msbuild</span> <span class="n">mxnet.sln</span> <span class="o">/</span><span class="n">p</span><span class="o">:</span><span class="n">Configuration</span><span class="o">=</span><span class="n">Release</span><span class="p">;</span><span class="n">Platform</span><span class="o">=</span><span class="n">x64</span> <span class="o">/</span><span class="n">maxcpucount</span>
</pre></div>
</div>
<p><strong>Option 2</strong></p>
<p>To build and install MXNet yourself using <a class="reference external" href="https://www.visualstudio.com/vs/older-downloads/">Microsoft Visual Studio 2015</a>, you need the following dependencies. Install the required dependencies:</p>
<ol class="simple">
<li>If <a class="reference external" href="https://www.visualstudio.com/vs/older-downloads/">Microsoft Visual Studio 2015</a> is not already installed, download and install it. You can download and install the free community edition. At least Update 3 of Microsoft Visual Studio 2015 is required to build MXNet from source. Upgrade via it&#8217;s <code class="docutils literal"><span class="pre">Tools</span> <span class="pre">-&gt;</span> <span class="pre">Extensions</span> <span class="pre">and</span> <span class="pre">Updates...</span> <span class="pre">|</span> <span class="pre">Product</span> <span class="pre">Updates</span></code> menu.</li>
<li>Download and install <a class="reference external" href="https://cmake.org/">CMake</a> if it is not already installed.</li>
<li>Download and install <a class="reference external" href="http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download">OpenCV</a>.</li>
<li>Unzip the OpenCV package.</li>
<li>Set the environment variable <code class="docutils literal"><span class="pre">OpenCV_DIR</span></code> to point to the <code class="docutils literal"><span class="pre">OpenCV</span> <span class="pre">build</span> <span class="pre">directory</span></code> (<code class="docutils literal"><span class="pre">C:\opencv\build\x64\vc14</span></code> for example). Also, you need to add the OpenCV bin directory (<code class="docutils literal"><span class="pre">C:\opencv\build\x64\vc14\bin</span></code> for example) to the <code class="docutils literal"><span class="pre">PATH</span></code> variable.</li>
<li>If you don&#8217;t have the Intel Math Kernel Library (MKL) installed, download and install <a class="reference external" href="http://sourceforge.net/projects/openblas/files/v0.2.14/">OpenBlas</a>.</li>
<li>Set the environment variable <code class="docutils literal"><span class="pre">OpenBLAS_HOME</span></code> to point to the <code class="docutils literal"><span class="pre">OpenBLAS</span></code> directory that contains the <code class="docutils literal"><span class="pre">include</span></code> and <code class="docutils literal"><span class="pre">lib</span></code> directories. Typically, you can find the directory in <code class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">files</span> <span class="pre">(x86)\OpenBLAS\</span></code>.</li>
<li>Download and install <a class="reference external" href="https://developer.nvidia.com/cuda-downloads?target_os=Windows&amp;target_arch=x86_64">CUDA</a> and <a class="reference external" href="https://developer.nvidia.com/cudnn">cuDNN</a>. To get access to the download link, register as an NVIDIA community user.</li>
<li>Set the environment variable <code class="docutils literal"><span class="pre">CUDACXX</span></code> to point to the <code class="docutils literal"><span class="pre">CUDA</span> <span class="pre">Compiler</span></code>(<code class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\NVIDIA</span> <span class="pre">GPU</span> <span class="pre">Computing</span> <span class="pre">Toolkit\CUDA\v9.1\bin\nvcc.exe</span></code> for example).</li>
<li>Set the environment variable <code class="docutils literal"><span class="pre">CUDNN_ROOT</span></code> to point to the <code class="docutils literal"><span class="pre">cuDNN</span></code> directory that contains the <code class="docutils literal"><span class="pre">include</span></code>, <code class="docutils literal"><span class="pre">lib</span></code> and <code class="docutils literal"><span class="pre">bin</span></code> directories (<code class="docutils literal"><span class="pre">C:\Downloads\cudnn-9.1-windows7-x64-v7\cuda</span></code> for example).</li>
</ol>
<p>After you have installed all of the required dependencies, build the MXNet source code:</p>
<ol class="simple">
<li>Download the MXNet source code from <a class="reference external" href="https://github.com/apache/incubator-mxnet">GitHub</a> (make sure you also download third parties submodules e.g. <code class="docutils literal"><span class="pre">git</span> <span class="pre">clone</span> <span class="pre">--recurse-submodules</span></code>).</li>
<li>Use <a class="reference external" href="https://cmake.org/">CMake</a> to create a Visual Studio solution in <code class="docutils literal"><span class="pre">./build</span></code>.</li>
<li>In Visual Studio, open the solution file,<code class="docutils literal"><span class="pre">.sln</span></code>, and compile it.
These commands produce a library called <code class="docutils literal"><span class="pre">mxnet.dll</span></code> in the <code class="docutils literal"><span class="pre">./build/Release/</span></code> or <code class="docutils literal"><span class="pre">./build/Debug</span></code> folder.</li>
</ol>
<p><p> </p>
Next, we install the <code class="docutils literal"><span class="pre">graphviz</span></code> library that we use for visualizing network graphs that you build on MXNet. We will also install <a class="reference external" href="http://jupyter.readthedocs.io/">Jupyter Notebook</a> which is used for running MXNet tutorials and examples.</p>
<ul class="simple">
<li>Install the <code class="docutils literal"><span class="pre">graphviz</span></code> by downloading the installer from the <a class="reference external" href="https://graphviz.gitlab.io/_pages/Download/Download_windows.html">Graphviz Download Page</a>.
<strong>Note</strong> Make sure to add the <code class="docutils literal"><span class="pre">graphviz</span></code> executable path to the PATH environment variable. Refer <a class="reference external" href="http://stackoverflow.com/questions/35064304/runtimeerror-make-sure-the-graphviz-executables-are-on-your-systems-path-aft">here for more details</a></li>
</ul>
<p><p> </p>
</p>
</div> <!-- End of pip -->
</div> <!-- End of GPU -->
</div> <!-- End of Python --><!-- START - Windows R CPU Installation Instructions --><div class="r">
<div class="cpu"><p>Install the latest version (3.5.1+) of R from <a class="reference external" href="https://cran.r-project.org/bin/windows/">CRAN</a>.
You can <a class="reference external" href="/versions/1.3.1/install/windows_setup.html#install-mxnet-package-for-r">build MXNet-R from source</a>, or you can use a pre-built binary:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">cran</span> <span class="o">&lt;-</span> <span class="nf">getOption</span><span class="p">(</span><span class="s">&quot;repos&quot;</span><span class="p">)</span>
<span class="n">cran[</span><span class="s">&quot;dmlc&quot;</span><span class="n">]</span> <span class="o">&lt;-</span> <span class="s">&quot;https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/&quot;</span>
<span class="nf">options</span><span class="p">(</span><span class="n">repos</span> <span class="o">=</span> <span class="n">cran</span><span class="p">)</span>
<span class="nf">install.packages</span><span class="p">(</span><span class="s">&quot;mxnet&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div> <!-- END - Windows R CPU --><div class="gpu"><p>You can <a class="reference external" href="/versions/1.3.1/install/windows_setup.html#install-mxnet-package-for-r">build MXNet-R from source</a>, or you can use a pre-built binary:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span> <span class="n">cran</span> <span class="o">&lt;-</span> <span class="nf">getOption</span><span class="p">(</span><span class="s">&quot;repos&quot;</span><span class="p">)</span>
<span class="n">cran[</span><span class="s">&quot;dmlc&quot;</span><span class="n">]</span> <span class="o">&lt;-</span> <span class="s">&quot;https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/GPU/cu92&quot;</span>
<span class="nf">options</span><span class="p">(</span><span class="n">repos</span> <span class="o">=</span> <span class="n">cran</span><span class="p">)</span>
<span class="nf">install.packages</span><span class="p">(</span><span class="s">&quot;mxnet&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Change cu92 to cu80, cu90 or cu91 based on your CUDA toolkit version. Currently, MXNet supports these versions of CUDA.</p>
</div> <!-- END of GPU -->
</div> <!-- END - Windows R --><div class="scala">
<div class="cpu gpu"><p>MXNet-Scala for Windows is not yet available.
<br></p>
</div> <!-- End of cpu gpu -->
</div> <!-- End of scala --><div class="julia perl">
<div class="cpu gpu"><p>Follow the installation instructions <a class="reference internal" href="windows_setup.html"><span class="doc">in this guide</span></a> to set up MXNet.</p>
</div> <!-- End of cpu gpu -->
</div> <!-- End of julia perl --><div class="cpp">
<div class="cpu gpu">
<p> To build the C++ package, please refer to <a href="build_from_source.html#build-the-c-package">this guide</a>. </p>
<br/>
</div> <!-- End of cpu gpu -->
</div> <!-- End of C++ -->
</div> <!-- End of Windows --><!-- START - Cloud Python Installation Instructions --><div class="cloud"><p>AWS Marketplace distributes Deep Learning AMIs (Amazon Machine Image) with MXNet pre-installed. You can launch one of these Deep Learning AMIs by following instructions in the <a class="reference external" href="http://docs.aws.amazon.com/dlami/latest/devguide/what-is-dlami.html">AWS Deep Learning AMI Developer Guide</a>.</p>
<p>You can also run distributed deep learning with <em>MXNet</em> on AWS using <a class="reference external" href="https://github.com/awslabs/deeplearning-cfn/blob/master/README.md">Cloudformation Template</a>.</p>
</div> <!-- END - Cloud Python Installation Instructions --><!-- DEVICES -->
<div class="devices">
<div class="raspberry-pi"><p>MXNet supports the Debian based Raspbian ARM based operating system so you can run MXNet on Raspberry Pi Devices.</p>
<p>These instructions will walk through how to build MXNet for the Raspberry Pi and install the Python bindings for the library.</p>
<p>You can do a dockerized cross compilation build on your local machine or a native build on-device.</p>
<p>The complete MXNet library and its requirements can take almost 200MB of RAM, and loading large models with the library can take over 1GB of RAM. Because of this, we recommend running MXNet on the Raspberry Pi 3 or an equivalent device that has more than 1 GB of RAM and a Secure Digital (SD) card that has at least 4 GB of free memory.</p>
<p><strong>Cross compilation build (Experimental)</strong></p>
<div class="section" id="docker-installation">
<span id="docker-installation"></span><h2>Docker installation<a class="headerlink" href="#docker-installation" title="Permalink to this headline"></a></h2>
<p><strong>Step 1</strong> Install Docker on your machine by following the <a class="reference external" href="https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository">docker installation instructions</a>.</p>
<p><em>Note</em> - You can install Community Edition (CE)</p>
<p><strong>Step 2</strong> [Optional] Post installation steps to manage Docker as a non-root user.</p>
<p>Follow the four steps in this <a class="reference external" href="https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user">docker documentation</a> to allow managing docker containers without <em>sudo</em>.</p>
</div>
<div class="section" id="build">
<span id="build"></span><h2>Build<a class="headerlink" href="#build" title="Permalink to this headline"></a></h2>
<p>The following command will build a container with dependencies and tools and then compile MXNet for
ARMv7. The resulting artifact will be located in <code class="docutils literal"><span class="pre">build/mxnet-x.x.x-py2.py3-none-any.whl</span></code>, copy this
file to your Raspberry Pi.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>ci/build.py -p armv7
</pre></div>
</div>
</div>
<div class="section" id="install">
<span id="install"></span><h2>Install<a class="headerlink" href="#install" title="Permalink to this headline"></a></h2>
<p>Create a virtualenv and install the package we created previously.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>virtualenv -p <span class="sb">`</span>which python3<span class="sb">`</span> mxnet_py3
<span class="nb">source</span> mxnet_py3/bin/activate
pip install mxnet-x.x.x-py2.py3-none-any.whl
</pre></div>
</div>
<p><strong>Native Build</strong></p>
<p>Installing MXNet is a two-step process:</p>
<ol class="simple">
<li>Build the shared library from the MXNet C++ source code.</li>
<li>Install the supported language-specific packages for MXNet.</li>
</ol>
<p><strong>Step 1</strong> Build the Shared Library</p>
<p>On Raspbian versions Wheezy and later, you need the following dependencies:</p>
<ul class="simple">
<li>Git (to pull code from GitHub)</li>
<li>libblas (for linear algebraic operations)</li>
<li>libopencv (for computer vision operations. This is optional if you want to save RAM and Disk Space)</li>
<li>A C++ compiler that supports C++ 11. The C++ compiler compiles and builds MXNet source code. Supported compilers include the following:</li>
<li><a class="reference external" href="https://gcc.gnu.org/gcc-4.8/">G++ (4.8 or later)</a>. Make sure to use gcc 4 and not 5 or 6 as there
are known bugs with these compilers.</li>
</ul>
<p>Install these dependencies using the following commands in any directory:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> sudo apt-get update
sudo apt-get -y install git cmake ninja-build build-essential g++-4.9 c++-4.9 liblapack* libblas* libopencv* libopenblas* python3-dev virtualenv
</pre></div>
</div>
<p>Clone the MXNet source code repository using the following <code class="docutils literal"><span class="pre">git</span></code> command in your home directory:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> git clone https://github.com/apache/incubator-mxnet.git --recursive
<span class="nb">cd</span> incubator-mxnet
</pre></div>
</div>
<p>Build:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> mkdir -p build <span class="o">&amp;&amp;</span> <span class="nb">cd</span> build
cmake <span class="se">\</span>
-DUSE_SSE<span class="o">=</span>OFF <span class="se">\</span>
-DUSE_CUDA<span class="o">=</span>OFF <span class="se">\</span>
-DUSE_OPENCV<span class="o">=</span>ON <span class="se">\</span>
-DUSE_OPENMP<span class="o">=</span>ON <span class="se">\</span>
-DUSE_MKL_IF_AVAILABLE<span class="o">=</span>OFF <span class="se">\</span>
-DUSE_SIGNAL_HANDLER<span class="o">=</span>ON <span class="se">\</span>
-DCMAKE_BUILD_TYPE<span class="o">=</span>Release <span class="se">\</span>
-GNinja ..
ninja -j1
</pre></div>
</div>
<p>Some compilation units require memory close to 1GB, so it&#8217;s recommended that you enable swap as
explained below and be cautious about increasing the number of jobs when building (-j)</p>
<p>Executing these commands start the build process, which can take up to a couple hours, and creates a file called <code class="docutils literal"><span class="pre">libmxnet.so</span></code> in the build directory.</p>
<p>If you are getting build errors in which the compiler is being killed, it is likely that the
compiler is running out of memory (especially if you are on Raspberry Pi 1, 2 or Zero, which have
less than 1GB of RAM), this can often be rectified by increasing the swapfile size on the Pi by
editing the file /etc/dphys-swapfile and changing the line CONF_SWAPSIZE=100 to CONF_SWAPSIZE=1024,
then running:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
free -m <span class="c1"># to verify the swapfile size has been increased</span>
</pre></div>
</div>
<p><strong>Step 2</strong> Install MXNet Python Bindings</p>
<p>To install Python bindings run the following commands in the MXNet directory:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> <span class="nb">cd</span> python
pip install --upgrade pip
pip install -e .
</pre></div>
</div>
<p>Note that the <code class="docutils literal"><span class="pre">-e</span></code> flag is optional. It is equivalent to <code class="docutils literal"><span class="pre">--editable</span></code> and means that if you edit the source files, these changes will be reflected in the package installed.</p>
<p>Alternatively you can create a whl package installable with pip with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>ci/docker/runtime_functions.sh build_wheel python/ <span class="k">$(</span>realpath build<span class="k">)</span>
</pre></div>
</div>
<p>You are now ready to run MXNet on your Raspberry Pi device. You can get started by following the tutorial on <a class="reference external" href="/versions/1.3.1/tutorials/embedded/wine_detector.html">Real-time Object Detection with MXNet On The Raspberry Pi</a>.</p>
<p><em>Note - Because the complete MXNet library takes up a significant amount of the Raspberry Pi&#8217;s limited RAM, when loading training data or large models into memory, you might have to turn off the GUI and terminate running processes to free RAM.</em></p>
</div> <!-- End of raspberry pi --><div class="nvidia-jetson"></div>
</div>
<div class="section" id="nvidia-jetson-tx-family">
<span id="nvidia-jetson-tx-family"></span><h1>Nvidia Jetson TX family<a class="headerlink" href="#nvidia-jetson-tx-family" title="Permalink to this headline"></a></h1>
<p>MXNet supports the Ubuntu Arch64 based operating system so you can run MXNet on NVIDIA Jetson Devices.</p>
<p>These instructions will walk through how to build MXNet for the Pascal based <a class="reference external" href="http://www.nvidia.com/object/embedded-systems-dev-kits-modules.html">NVIDIA Jetson TX2</a> and install the corresponding python language bindings.</p>
<p>For the purposes of this install guide we will assume that CUDA is already installed on your Jetson device.</p>
<p><strong>Install MXNet</strong></p>
<p>Installing MXNet is a two-step process:</p>
<ol class="simple">
<li>Build the shared library from the MXNet C++ source code.</li>
<li>Install the supported language-specific packages for MXNet.</li>
</ol>
<p><strong>Step 1</strong> Build the Shared Library</p>
<p>You need the following additional dependencies:</p>
<ul class="simple">
<li>Git (to pull code from GitHub)</li>
<li>libatlas (for linear algebraic operations)</li>
<li>libopencv (for computer vision operations)</li>
<li>python pip (to load relevant python packages for our language bindings)</li>
</ul>
<p>Install these dependencies using the following commands in any directory:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> sudo apt-get update
sudo apt-get -y install git build-essential libatlas-base-dev libopencv-dev graphviz python-pip
sudo pip install pip --upgrade
sudo pip install setuptools numpy --upgrade
sudo pip install graphviz jupyter
</pre></div>
</div>
<p>Clone the MXNet source code repository using the following <code class="docutils literal"><span class="pre">git</span></code> command in your home directory:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> git clone https://github.com/apache/incubator-mxnet.git --recursive
<span class="nb">cd</span> incubator-mxnet
</pre></div>
</div>
<p>Edit the Makefile to install the MXNet with CUDA bindings to leverage the GPU on the Jetson:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> cp make/crosscompile.jetson.mk config.mk
</pre></div>
</div>
<p>Edit the Mshadow Makefile to ensure MXNet builds with Pascal&#8217;s hardware level low precision acceleration by editing 3rdparty/mshadow/make/mshadow.mk and adding the following after line 122:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nv">MSHADOW_CFLAGS</span> <span class="o">+=</span> -DMSHADOW_USE_PASCAL<span class="o">=</span><span class="m">1</span>
</pre></div>
</div>
<p>Now you can build the complete MXNet library with the following command:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> make -j <span class="k">$(</span>nproc<span class="k">)</span>
</pre></div>
</div>
<p>Executing this command creates a file called <code class="docutils literal"><span class="pre">libmxnet.so</span></code> in the mxnet/lib directory.</p>
<p><strong>Step 2</strong> Install MXNet Python Bindings</p>
<p>To install Python bindings run the following commands in the MXNet directory:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> <span class="nb">cd</span> python
pip install --upgrade pip
pip install -e .
</pre></div>
</div>
<p>Note that the <code class="docutils literal"><span class="pre">-e</span></code> flag is optional. It is equivalent to <code class="docutils literal"><span class="pre">--editable</span></code> and means that if you edit the source files, these changes will be reflected in the package installed.</p>
<p>Add the mxnet folder to the path:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span> <span class="nb">cd</span> ..
<span class="nb">export</span> <span class="nv">MXNET_HOME</span><span class="o">=</span><span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span>
<span class="nb">echo</span> <span class="s2">&quot;export PYTHONPATH=</span><span class="nv">$MXNET_HOME</span><span class="s2">/python:</span><span class="nv">$PYTHONPATH</span><span class="s2">&quot;</span> &gt;&gt; ~/.bashrc
<span class="nb">source</span> ~/.bashrc
</pre></div>
</div>
<p>You are now ready to run MXNet on your NVIDIA Jetson TX2 device.</p>
</div> <!-- End of jetson -->
</div> <!-- End of devices --><!-- This # tag restarts the page and allows reuse
of the div classes for validation sections, etc --></div>
<div class="section" id="validate-mxnet-installation">
<span id="validate-mxnet-installation"></span><h1>Validate MXNet Installation<a class="headerlink" href="#validate-mxnet-installation" title="Permalink to this headline"></a></h1>
<div class="linux macos">
<div class="python">
<div class="cpu"><div class="pip build-from-source"><p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
</div><div class="docker"><p>Launch a Docker container with <code class="docutils literal"><span class="pre">mxnet/python</span></code> image and run example <em>MXNet</em> python program on the terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker run -it mxnet/python bash <span class="c1"># Use sudo if you skip Step 2 in the installation instruction</span>
<span class="c1"># Start a python terminal</span>
root@4919c4f58cac:/# python
</pre></div>
</div>
</div><div class="virtualenv"><p>Activate the virtualenv environment created for <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> ~/mxnet/bin/activate
</pre></div>
</div>
<p>After activating the environment, you should see the prompt as below.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$
</pre></div>
</div>
<p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
</div><p>Run a short <em>MXNet</em> python program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</div><!-- linux macos -->
</div><!-- python -->
</div><!-- cpu --><!-- Validate Windows CPU pip install --><div class="windows">
<div class="python">
<div class="cpu">
<div class="pip"><p>Run a short <em>MXNet</em> python program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</div>
</div>
</div>
</div><!-- Mac OS GPU installation validation --><div class="macos">
<div class="python">
<div class="gpu"><div class="pip virtualenv docker">
</br><p>Will be available soon.</p>
</div><div class="build-from-source">
</br><p>From the MXNet root directory run: <code class="docutils literal"><span class="pre">python</span> <span class="pre">example/image-classification/train_mnist.py</span> <span class="pre">--network</span> <span class="pre">lenet</span> <span class="pre">--gpus</span> <span class="pre">0</span></code> to test GPU training.</p>
</div></div>
</div>
</div><!-- Windows GPU installation validation --><div class="windows">
<div class="python">
<div class="gpu"><div class="virtualenv docker">
</br><p>Will be available soon.</p>
</div><div class="pip build-from-source">
</br><p>From the MXNet root directory run: <code class="docutils literal"><span class="pre">python</span> <span class="pre">example/image-classification/train_mnist.py</span> <span class="pre">--network</span> <span class="pre">lenet</span> <span class="pre">--gpus</span> <span class="pre">0</span></code> to test GPU training.</p>
</div></div><!-- windows -->
</div><!-- python -->
</div><!-- gpu --><!-- Validation for GPU machines --><div class="linux">
<div class="python">
<div class="gpu"><div class="pip build-from-source"><p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
</div><div class="docker"><p>Launch a NVIDIA Docker container with <code class="docutils literal"><span class="pre">mxnet/python:gpu</span></code> image and run example <em>MXNet</em> python program on the terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ nvidia-docker run -it mxnet/python:gpu bash <span class="c1"># Use sudo if you skip Step 2 in the installation instruction</span>
<span class="c1"># Start a python terminal</span>
root@4919c4f58cac:/# python
</pre></div>
</div>
</div><div class="virtualenv"><p>Activate the virtualenv environment created for <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> ~/mxnet/bin/activate
</pre></div>
</div>
<p>After activating the environment, you should see the prompt as below.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$
</pre></div>
</div>
<p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
</div><p>Run a short <em>MXNet</em> python program to create a 2X3 matrix of ones <em>a</em> on a <em>GPU</em>, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3. We use <em>mx.gpu()</em>, to set <em>MXNet</em> context to be GPUs.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">())</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</div><!-- linux -->
</div><!-- python -->
</div><!-- gpu --><!-- Linux Clean up -->
<div class="linux">
<div class="python">
<div class="cpu"><div class="pip build-from-source"><p>Exit the Python terminal.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">$</span>
</pre></div>
</div>
</div><div class="virtualenv"><p>Exit the Python terminal and Deactivate the virtualenv <em>MXNet</em> environment.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">(mxnet)$ deactivate</span>
<span class="go">$</span>
</pre></div>
</div>
</div><div class="docker"><p>Exit the Python terminal and mxnet/python docker container.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">root@4919c4f58cac:/# exit</span>
</pre></div>
</div>
</div></div>
</div>
</div><!-- MacOS Clean up -->
<div class="macos">
<div class="python">
<div class="cpu"><div class="pip build-from-source"><p>Exit the Python terminal.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">$</span>
</pre></div>
</div>
</div><div class="virtualenv"><p>Exit the Python terminal and Deactivate the virtualenv <em>MXNet</em> environment.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">(mxnet)$ deactivate</span>
<span class="go">$</span>
</pre></div>
</div>
</div><div class="docker"><p>Exit the Python terminal and then the docker container.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">root@4919c4f58cac:/# exit</span>
</pre></div>
</div>
</div></div>
</div>
</div><!-- Validation for cloud installation --><div class="cloud"><p>Login to the cloud instance you launched, with pre-installed <em>MXNet</em>, following the guide by corresponding cloud provider.</p>
<p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
<!-- Example Python code for CPU --><div class="cpu"><p>Run a short <em>MXNet</em> python program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
<p>Exit the Python terminal.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">exit</span><span class="p">()</span>
<span class="go">$</span>
</pre></div>
</div>
</div><!-- Example Python code for CPU --><div class="gpu"><p>Run a short <em>MXNet</em> python program to create a 2X3 matrix of ones <em>a</em> on a <em>GPU</em>, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3. We use <em>mx.gpu()</em>, to set <em>MXNet</em> context to be GPUs.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">())</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</div></div><!-- Example R code for CPU --><div class="linux macos windows">
<div class="r">
<div class="cpu"><p>Run a short <em>MXNet</em> R program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="nf">library</span><span class="p">(</span><span class="n">mxnet</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&lt;-</span> <span class="nf">mx.nd.ones</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">3</span><span class="p">),</span> <span class="n">ctx</span> <span class="o">=</span> <span class="nf">mx.cpu</span><span class="p">())</span>
<span class="n">b</span> <span class="o">&lt;-</span> <span class="n">a</span> <span class="o">*</span> <span class="m">2</span> <span class="o">+</span> <span class="m">1</span>
<span class="n">b</span>
</pre></div>
</div>
<p>You should see the following output:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">[</span><span class="p">,</span><span class="m">1</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">2</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">3</span><span class="n">]</span>
<span class="n">[1</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
<span class="n">[2</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
</pre></div>
</div>
</div>
</div>
</div><!-- Example R code for GPU --><div class="linux macos windows">
<div class="r">
<div class="gpu"><p>Run a short <em>MXNet</em> R program to create a 2X3 matrix of ones <em>a</em> on a <em>GPU</em>, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3. We use <em>mx.gpu()</em>, to set <em>MXNet</em> context to be GPUs.</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="nf">library</span><span class="p">(</span><span class="n">mxnet</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&lt;-</span> <span class="nf">mx.nd.ones</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">3</span><span class="p">),</span> <span class="n">ctx</span> <span class="o">=</span> <span class="nf">mx.gpu</span><span class="p">())</span>
<span class="n">b</span> <span class="o">&lt;-</span> <span class="n">a</span> <span class="o">*</span> <span class="m">2</span> <span class="o">+</span> <span class="m">1</span>
<span class="n">b</span>
</pre></div>
</div>
<p>You should see the following output:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">[</span><span class="p">,</span><span class="m">1</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">2</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">3</span><span class="n">]</span>
<span class="n">[1</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
<span class="n">[2</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
</pre></div>
</div>
</div>
</div>
</div><div class="linux">
<div class="scala"><div class="cpu gpu">
Run the <a href="https://github.com/apache/incubator-mxnet/tree/1.3.1/scala-package/mxnet-demo">MXNet-Scala demo project</a> to validate your Maven package installation.
</div></div><!-- scala --><div class="julia perl cpp">
<div class="cpu gpu"><p>Will be available soon.</p>
</div><!-- cpu gpu -->
</div><!-- julia perl cpp -->
</div><!-- linux --><div class="macos">
<div class="scala">
<div class="cpu gpu">
Run the <a href="https://github.com/apache/incubator-mxnet/tree/1.3.1/scala-package/mxnet-demo">MXNet-Scala demo project</a> to validate your Maven package installation.
</div><!-- cpu gpu-->
</div><!-- scala -->
<div class="julia perl cpp">
<div class="cpu gpu"><p>Will be available soon.</p>
</div><!-- cpu gpu -->
</div><!-- julia perl cpp -->
</div><!-- macos --><!-- Windows MXNet Installation validation -->
<div class="windows">
<div class="python">
<div class="cpu"><div class="build-from-source virtualenv docker">
<br/>
Will be available soon.
</div></div>
</div><div class="scala julia perl cpp">
<div class="cpu gpu"><p>Will be available soon.</p>
</div>
</div>
</div>
<!-- End Windows Installation validation --><p><br/></p>
<!-- Download --></div>
<div class="section" id="source-download">
<span id="source-download"></span><h1>Source Download<a class="headerlink" href="#source-download" title="Permalink to this headline"></a></h1>
<p><a href="download.html">Download</a> your required version of MXNet.</p>
</div>
</div>
</div>
<div class="sphinxsidebar rightsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Installing MXNet</a><ul>
<li><a class="reference internal" href="#docker-installation">Docker installation</a></li>
<li><a class="reference internal" href="#build">Build</a></li>
<li><a class="reference internal" href="#install">Install</a></li>
</ul>
</li>
<li><a class="reference internal" href="#nvidia-jetson-tx-family">Nvidia Jetson TX family</a></li>
<li><a class="reference internal" href="#validate-mxnet-installation">Validate MXNet Installation</a></li>
<li><a class="reference internal" href="#source-download">Source Download</a></li>
</ul>
</div>
</div>
</div><div class="footer">
<div class="section-disclaimer">
<div class="container">
<div>
<img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/apache_incubator_logo.png" height=60>
<p>
Apache MXNet is an effort undergoing incubation at The Apache Software Foundation (ASF), <strong>sponsored by the <i>Apache Incubator</i></strong>. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
</p>
<p>
"Copyright © 2017-2018, The Apache Software Foundation
Apache MXNet, MXNet, Apache, the Apache feather, and the Apache MXNet project logo are either registered trademarks or trademarks of the Apache Software Foundation."
</p>
</div>
</div>
</div>
</div> <!-- pagename != index -->
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script type="text/javascript" src="../_static/js/sidebar.js"></script>
<script type="text/javascript" src="../_static/js/search.js"></script>
<script type="text/javascript" src="../_static/js/navbar.js"></script>
<script type="text/javascript" src="../_static/js/clipboard.min.js"></script>
<script type="text/javascript" src="../_static/js/copycode.js"></script>
<script type="text/javascript" src="../_static/js/page.js"></script>
<script type="text/javascript" src="../_static/js/docversion.js"></script>
<script type="text/javascript">
$('body').ready(function () {
$('body').css('visibility', 'visible');
});
</script>
</body>
</html>