<divid="unreleased-message"> You are reading an old version of the documentation (v3.2.0). 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="#id9">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="test-data">
<h3><aclass="toc-backref" href="#id10">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.org/project/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="#id11">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="#id12">Scientific Python Distributions</a><aclass="headerlink" href="#scientific-python-distributions" title="Permalink to this headline">¶</a></h3>
<p><aclass="reference external" href="https://www.anaconda.com/">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="#id13">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="#id14">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.org/project/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, and see <aclass="reference internal" href="../faq/installing_faq.html#install-from-git"><spanclass="std std-ref">Install from source</span></a>.</p>
<spanclass="target" id="index-2"></span><codeclass="xref std std-envvar docutils literal notranslate"><spanclass="pre">PKG_CONFIG</span></code> are respected. This means you can set them if your
toolchain is prefixed. This may be used for cross compiling.</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>
<divclass="section" id="dependencies">
<spanid="install-requirements"></span><h3><aclass="toc-backref" href="#id15">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 external" href="https://docs.python.org/3/library/tk.html">Tk</a> (>= 8.3, != 8.6.0 or
8.6.1): for the Tk-based backends;</li>
<li><aclass="reference external" href="https://pypi.org/project/PyQt4">PyQt4</a> (>= 4.6) or
<aclass="reference external" href="https://pypi.org/project/PySide">PySide</a> (>= 1.0.3) <aclass="footnote-reference" href="#id4" id="id1">[1]</a>: for the
Qt4-based backends;</li>
<li><aclass="reference external" href="https://pypi.org/project/PyQt5">PyQt5</a>: for the Qt5-based backends;</li>
<li><aclass="reference external" href="https://pypi.org/project/PyGObject/">PyGObject</a>: for the GTK3-based
<tr><tdclass="label"><aclass="fn-backref" href="#id3">[3]</a></td><td>If using pip (and not conda) on Linux, wxPython wheels must be manually
downloaded from <aclass="reference external" href="https://wxpython.org/pages/downloads/">https://wxpython.org/pages/downloads/</a>.</td></tr>
</tbody>
</table>
<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>
<li><aclass="reference external" href="https://www.fontconfig.org">fontconfig</a> (>= 2.7): for detection of system
fonts on Linux.</li>
</ul>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>Matplotlib depends on non-Python libraries.</p>
<p>On Linux and OSX, <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>
<p>If not using pkg-config (in particular on Windows), you may need to set the
include path (to the FreeType, libpng, and zlib headers) and link path (to
the FreeType, libpng, and zlib libraries) explicitly, if they are not in
standard locations. This can be done using standard environment variables
<pclass="last">where <codeclass="docutils literal notranslate"><spanclass="pre">...</span></code> means "also give, in the same format, the directories
containing <codeclass="docutils literal notranslate"><spanclass="pre">png.h</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">zlib.h</span></code> for the include path, and for
<codeclass="docutils literal notranslate"><spanclass="pre">libpng.so</span></code>/<codeclass="docutils literal notranslate"><spanclass="pre">png.lib</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">libz.so</span></code>/<codeclass="docutils literal notranslate"><spanclass="pre">z.lib</span></code> for the link path."</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="docutils literal notranslate"><spanclass="pre">Agg</span></code>: the Anti-Grain Geometry C++ rendering engine;</li>
<li><codeclass="docutils literal notranslate"><spanclass="pre">qhull</span></code>: to compute Delaunay triangulation;</li>
<li><codeclass="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="#id16">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="#id17">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="#id18">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="#id19">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