<divid="unreleased-message"> You are reading an old version of the documentation (v3.0.3). For the latest version see <ahref="https://matplotlib.org/stable/users/installing.html">https://matplotlib.org/stable/users/installing.html</a></div>
<h2><aclass="toc-backref" href="#id3">Installing an official release</a><aclass="headerlink" href="#installing-an-official-release" title="Permalink to this headline">¶</a></h2>
<p>Matplotlib and its dependencies are available as wheel packages for macOS,
<p>Although not required, we suggest also installing <codeclass="docutils literal notranslate"><spanclass="pre">IPython</span></code> for
interactive use. To easily install a complete Scientific Python
stack, see <aclass="reference internal" href="#install-scipy-dists"><spanclass="std std-ref">Scientific Python Distributions</span></a> below.</p>
<divclass="section" id="macos">
<h3><aclass="toc-backref" href="#id4">macOS</a><aclass="headerlink" href="#macos" title="Permalink to this headline">¶</a></h3>
<p>To use the native OSX backend you will need <aclass="reference internal" href="../faq/osx_framework.html#osxframework-faq"><spanclass="std std-ref">a framework build</span></a> build of Python.</p>
</div>
<divclass="section" id="test-data">
<h3><aclass="toc-backref" href="#id5">Test data</a><aclass="headerlink" href="#test-data" title="Permalink to this headline">¶</a></h3>
<p>The wheels (<codeclass="file docutils literal notranslate"><spanclass="pre">*.whl</span></code>) on the <aclass="reference external" href="https://pypi.python.org/pypi/matplotlib/">PyPI download page</a> do not contain test data
or example code.</p>
<p>If you want to try the many demos that come in the Matplotlib source
distribution, download the <codeclass="file docutils literal notranslate"><spanclass="pre">*.tar.gz</span></code> file and look in the
<h2><aclass="toc-backref" href="#id6">Third-party distributions of Matplotlib</a><aclass="headerlink" href="#third-party-distributions-of-matplotlib" title="Permalink to this headline">¶</a></h2>
<spanid="install-scipy-dists"></span><h3><aclass="toc-backref" href="#id7">Scientific Python Distributions</a><aclass="headerlink" href="#scientific-python-distributions" title="Permalink to this headline">¶</a></h3>
<p><aclass="reference external" href="https://www.continuum.io/downloads/">Anaconda</a> and <aclass="reference external" href="https://www.enthought.com/products/canopy/">Canopy</a> and <aclass="reference external" href="https://www.activestate.com/activepython/downloads">ActiveState</a> are excellent
choices that "just work" out of the box for Windows, macOS and common
Linux platforms. <aclass="reference external" href="https://winpython.github.io/">WinPython</a> is an
option for Windows users. All of these distributions include
Matplotlib and <em>lots</em> of other useful (data) science tools.</p>
<h3><aclass="toc-backref" href="#id8">Linux: using your package manager</a><aclass="headerlink" href="#linux-using-your-package-manager" title="Permalink to this headline">¶</a></h3>
<p>If you are on Linux, you might prefer to use your package manager. Matplotlib
is packaged for almost every major Linux distribution.</p>
<spanid="install-from-source"></span><h2><aclass="toc-backref" href="#id9">Installing from source</a><aclass="headerlink" href="#installing-from-source" title="Permalink to this headline">¶</a></h2>
<p>If you are interested in contributing to Matplotlib development,
running the latest source code, or just like to build everything
yourself, it is not difficult to build Matplotlib from source. Grab
the latest <em>tar.gz</em> release file from <aclass="reference external" href="https://pypi.python.org/pypi/matplotlib/">the PyPI files page</a>, or if you want to
develop Matplotlib or just need the latest bugfixed version, grab the
latest git version <aclass="reference internal" href="../faq/installing_faq.html#install-from-git"><spanclass="std std-ref">Install from source</span></a>.</p>
<p>We provide a <aclass="reference external" href="https://raw.githubusercontent.com/matplotlib/matplotlib/master/setup.cfg.template">setup.cfg</a> file which you can use to customize the build
process. For example, which default backend to use, whether some of the
optional libraries that Matplotlib ships with are installed, and so on. This
file will be particularly useful to those packaging Matplotlib.</p>
<p>If you have installed prerequisites to nonstandard places and need to
inform Matplotlib where they are, edit <codeclass="docutils literal notranslate"><spanclass="pre">setupext.py</span></code> and add the base
dirs to the <codeclass="docutils literal notranslate"><spanclass="pre">basedir</span></code> dictionary entry for your <codeclass="docutils literal notranslate"><spanclass="pre">sys.platform</span></code>;
e.g., if the header of some required library is in
<codeclass="docutils literal notranslate"><spanclass="pre">/some/path/include/someheader.h</span></code>, put <codeclass="docutils literal notranslate"><spanclass="pre">/some/path</span></code> in the
<codeclass="docutils literal notranslate"><spanclass="pre">basedir</span></code> list for your platform.</p>
<divclass="section" id="dependencies">
<spanid="install-requirements"></span><h3><aclass="toc-backref" href="#id10">Dependencies</a><aclass="headerlink" href="#dependencies" title="Permalink to this headline">¶</a></h3>
<p>Matplotlib requires the following dependencies:</p>
<p>Optionally, you can also install a number of packages to enable better user
interface toolkits. See <aclass="reference internal" href="../tutorials/introductory/usage.html#what-is-a-backend"><spanclass="std std-ref">What is a backend?</span></a> for more details on the
optional Matplotlib backends and the capabilities they provide.</p>
<ulclass="simple">
<li><aclass="reference internal" href="../glossary/index.html#term-tk"><spanclass="xref std std-term">tk</span></a> (>= 8.3, != 8.6.0 or 8.6.1): for the Tk-based backends;</li>
<li><aclass="reference external" href="https://pypi.python.org/pypi/PyQt4">PyQt4</a> (>= 4.6) or
<aclass="reference external" href="https://pypi.python.org/pypi/PySide">PySide</a> (>= 1.0.3): for the Qt4-based
backends;</li>
<li><aclass="reference external" href="https://pypi.python.org/pypi/PyQt5">PyQt5</a>: for the Qt5-based backends;</li>
<li><aclass="reference external" href="https://pypi.org/project/PyGObject/">PyGObject</a> or
<aclass="reference external" href="https://pypi.org/project/pgi/">pgi</a> (>= 0.0.11.2): for the GTK3-based
backends;</li>
<li><aclass="reference internal" href="../glossary/index.html#term-wxpython"><spanclass="xref std std-term">wxpython</span></a> (>= 4): for the WX-based backends;</li>
<li><aclass="reference external" href="https://cairocffi.readthedocs.io/en/latest/">cairocffi</a> (>= 0.8) or
<aclass="reference external" href="https://pypi.python.org/pypi/pycairo">pycairo</a>: for the cairo-based
backends;</li>
<li><aclass="reference external" href="https://pypi.python.org/pypi/tornado">Tornado</a>: for the WebAgg backend;</li>
</ul>
<p>For better support of animation output format and image file formats, LaTeX,
etc., you can install the following:</p>
<ulclass="simple">
<li><aclass="reference external" href="https://www.ffmpeg.org/">ffmpeg</a>/<aclass="reference external" href="https://libav.org/avconv.html">avconv</a>: for saving movies;</li>
<li><aclass="reference external" href="https://www.imagemagick.org/script/index.php">ImageMagick</a>: for saving
animated gifs;</li>
<li><aclass="reference external" href="https://pillow.readthedocs.io/en/latest/">Pillow</a> (>= 3.4): for a larger
selection of image file formats: JPEG, BMP, and TIFF image files;</li>
<li><aclass="reference external" href="https://miktex.org/">LaTeX</a> and <aclass="reference external" href="https://ghostscript.com/download/">GhostScript (>=9.0)</a> : for rendering text with LaTeX.</li>
</ul>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">Matplotlib depends on non-Python libraries. <aclass="reference external" href="https://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</a> can be used
to find required non-Python libraries and thus make the install go more
smoothly if the libraries and headers are not in the expected locations.</p>
</div>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>The following libraries are shipped with Matplotlib:</p>
<ulclass="last simple">
<li><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Agg</span></code>: the Anti-Grain Geometry C++ rendering engine;</li>
<li><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">qhull</span></code>: to compute Delaunay triangulation;</li>
<li><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">ttconv</span></code>: a TrueType font utility.</li>
</ul>
</div>
</div>
<divclass="section" id="building-on-linux">
<spanid="build-linux"></span><h3><aclass="toc-backref" href="#id11">Building on Linux</a><aclass="headerlink" href="#building-on-linux" title="Permalink to this headline">¶</a></h3>
<p>It is easiest to use your system package manager to install the dependencies.</p>
<p>If you are on Debian/Ubuntu, you can get all the dependencies
<p>These commands do not build Matplotlib, but instead get and install the
build dependencies, which will make building from source easier.</p>
</div>
<divclass="section" id="building-on-macos">
<spanid="build-osx"></span><h3><aclass="toc-backref" href="#id12">Building on macOS</a><aclass="headerlink" href="#building-on-macos" title="Permalink to this headline">¶</a></h3>
<p>The build situation on macOS is complicated by the various places one
can get the libpng and FreeType requirements (MacPorts, Fink,
/usr/X11R6), the different architectures (e.g., x86, ppc, universal), and
the different macOS versions (e.g., 10.4 and 10.5). We recommend that you build
the way we do for the macOS release: get the source from the tarball or the
git repository and install the required dependencies through a third-party
package manager. Two widely used package managers are Homebrew, and MacPorts.
The following example illustrates how to install libpng and FreeType using
<p>Note that your environment is somewhat important. Some conda users have
found that, to run the tests, their PYTHONPATH must include
/path/to/anaconda/.../site-packages and their DYLD_FALLBACK_LIBRARY_PATH
must include /path/to/anaconda/lib.</p>
</div>
<divclass="section" id="building-on-windows">
<spanid="build-windows"></span><h3><aclass="toc-backref" href="#id13">Building on Windows</a><aclass="headerlink" href="#building-on-windows" title="Permalink to this headline">¶</a></h3>
<p>The Python shipped from <aclass="reference external" href="https://www.python.org">https://www.python.org</a> is compiled with Visual Studio
2015 for 3.5+. Python extensions should be compiled with the same
<h4><aclass="toc-backref" href="#id14">Wheel builds using conda packages</a><aclass="headerlink" href="#wheel-builds-using-conda-packages" title="Permalink to this headline">¶</a></h4>
<p>This is a wheel build, but we use conda packages to get all the requirements.
The binary requirements (png, FreeType,...) are statically linked and therefore
not needed during the wheel install.</p>
<p>Set up the conda environment. Note, if you want a qt backend, add <codeclass="docutils literal notranslate"><spanclass="pre">pyqt</span></code> to