<divid="unreleased-message"> You are reading an old version of the documentation (v1.2.1). For the latest version see <ahref="https://matplotlib.org/stable/users/installing.html">https://matplotlib.org/stable/users/installing.html</a></div>
<h1>Installing<aclass="headerlink" href="#installing" title="Permalink to this headline">¶</a></h1>
<p>There are many different ways to install matplotlib, and the best way
depends on what operating system you are using, what you already have
installed, and how you want to use it. To avoid wading through all
the details (and potential complications) on this page, the easiest
thing for you to do is use one of the pre-packaged python
distributions that already provide matplotlib built-in. The Enthought
Python Distribution <aclass="reference external" href="http://www.enthought.com/products/epd.php">(EPD)</a> for Windows, OS X or
Redhat is an excellent choice that “just works” out of the box.
Another excellent alternative for Windows users is <aclass="reference external" href="http://www.pythonxy.com/">Python (x, y)</a> which tends to be updated a bit more
frequently. Both of these packages include matplotlib and pylab, and
<em>lots</em> of other useful tools. matplotlib is also packaged for almost
every major Linux distribution. So if you are on Linux, your package
manager will probably provide matplotlib prebuilt.</p>
<h2>Manually installing pre-built packages<aclass="headerlink" href="#manually-installing-pre-built-packages" title="Permalink to this headline">¶</a></h2>
<divclass="section" id="general-instructions">
<h3>General instructions<aclass="headerlink" href="#general-instructions" title="Permalink to this headline">¶</a></h3>
<p>For some people, the prepackaged pythons discussed above are not an
option. That’s OK, it’s usually pretty easy to get a custom install
working. You will first need to find out if you have python installed
on your machine, and if not, install it. The official python builds
are available for download <aclass="reference external" href="http://www.python.org/download">here</a>,
but OS X users please read <aclass="reference internal" href="../faq/installing_faq.html#which-python-for-osx"><em>Which python for OS X?</em></a>.</p>
<p>Once you have python up and running, you will need to install <aclass="reference external" href="http://www.numpy.org/">numpy</a>. numpy provides high-performance array data
structures and mathematical functions, and is a requirement for
<p>matplotlib requires numpy version 1.4 or later.
Although it is not a requirement to use matplotlib, we strongly
encourage you to install <aclass="reference external" href="http://ipython.org">ipython</a>, which is an
interactive shell for python that is matplotlib-aware.</p>
<p>Next, we need to get matplotlib installed. We provide prebuilt
binaries for OS X and Windows on the matplotlib <aclass="reference external" href="https://github.com/matplotlib/matplotlib/downloads/">download</a> page. Click on
the latest release of the “matplotlib” package, choose your python
version (2.6, 2.7 or 3.2) and your platform (macosx or win32). If you
have any problems, please check the <aclass="reference internal" href="../faq/installing_faq.html#installing-faq"><em>Installation</em></a>, search
using Google, and/or post a question the <aclass="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=80706">mailing list</a>.</p>
<p>If you are on Debian/Ubuntu linux, it suffices to do:</p>
Welcome to pylab, a matplotlib-based Python environment.
For more information, type 'help(pylab)'.
In [1]: x = randn(10000)
In [2]: hist(x, 100)</pre>
</div>
<p>Note that when testing matplotlib installations from the interactive
python console, there are some issues relating to user interface
toolkits and interactive settings that are discussed in
<aclass="reference internal" href="shell.html#mpl-shell"><em>Using matplotlib in a python shell</em></a>.</p>
</div>
<divclass="section" id="installing-on-windows">
<h3>Installing on Windows<aclass="headerlink" href="#installing-on-windows" title="Permalink to this headline">¶</a></h3>
<p>If you don’t already have python installed, you may want to consider
using the Enthought edition of python, which has scipy, numpy, and
wxpython, plus many other useful packages, preinstalled - <aclass="reference external" href="http://www.enthought.com/python">Enthought
Python</a>. With the Enthought
edition of python + matplotlib installer, the following backends
should work out of the box: agg, wx, wxagg, tkagg, ps, pdf and svg.</p>
<p>For standard python installations, you will also need to install numpy
in addition to the matplotlib installer. On some systems you will
also need to download msvcp71.dll library, which you can download from
<aclass="reference external" href="http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71">http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71</a> or other
sites. You will need to unzip the archive and drag the dll into
<p>All of the GUI backends run on Windows, but TkAgg is probably the
best for interactive use from the standard python shell or ipython.
The Windows installer (<ttclass="file docutils literal"><spanclass="pre">*.exe</span></tt>) on the download page contains all the
code you need to get up and running. However, there are many
examples that are not included in the Windows installer. If you
want to try the many demos that come in the matplotlib source
distribution, download the zip file and look in the <ttclass="file docutils literal"><spanclass="pre">examples</span></tt>
subdirectory.</p>
</div>
</div>
<divclass="section" id="installing-from-source">
<spanid="install-from-source"></span><h2>Installing from source<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://github.com/matplotlib/matplotlib/downloads">the download 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"><em>Source install from git</em></a>.</p>
<p>Once you have satisfied the requirements detailed below (mainly
python, numpy, libpng and freetype), you can build matplotlib:</p>
<divclass="highlight-python"><pre>cd matplotlib
python setup.py build
python setup.py install</pre>
</div>
<p>We provide a <aclass="reference external" href="https://github.com/matplotlib/matplotlib/raw/master/setup.cfg.template">setup.cfg</a>
file that goes with <ttclass="file docutils literal"><spanclass="pre">setup.py</span></tt> 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 <ttclass="docutils literal"><spanclass="pre">setupext.py</span></tt> and add the base
dirs to the <ttclass="docutils literal"><spanclass="pre">basedir</span></tt> dictionary entry for your <ttclass="docutils literal"><spanclass="pre">sys.platform</span></tt>.
e.g., if the header to some required library is in
<ttclass="docutils literal"><spanclass="pre">/some/path/include/someheader.h</span></tt>, put <ttclass="docutils literal"><spanclass="pre">/some/path</span></tt> in the
<ttclass="docutils literal"><spanclass="pre">basedir</span></tt> list for your platform.</p>
</div>
<divclass="section" id="build-requirements">
<spanid="install-requirements"></span><h2>Build requirements<aclass="headerlink" href="#build-requirements" title="Permalink to this headline">¶</a></h2>
<p>These are external packages which you will need to install before
installing matplotlib. Windows users only need the first two (python
and numpy) since the others are built into the matplotlib Windows
installers available for download at <ttclass="xref py py-obj docutils literal"><spanclass="pre">the</span><spanclass="pre">download</span><spanclass="pre">page</span>
<spanclass="pre"><https://github.com/matplotlib/matplotlib/downloads>_</span></tt>. If you are
building on OSX, see <aclass="reference internal" href="#build-osx"><em>Building on OSX</em></a>. If you are installing
dependencies with a package manager on Linux, you may need to install
the development packages (look for a “-dev” postfix) in addition to
the libraries themselves.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>If you are on debian/ubuntu, you can get all the dependencies
<dd>library for reading true type font files. If you are a windows
user, you can ignore this since we build support into the
matplotlib single click installer.</dd>
</dl>
<p><strong>Optional</strong></p>
<p>These are optional packages which you may want to install to use
matplotlib with a user interface toolkit. See
<aclass="reference internal" href="../faq/usage_faq.html#what-is-a-backend"><em>What is a backend?</em></a> for more details on the optional matplotlib
backends and the capabilities they provide.</p>
<dlclass="docutils">
<dt><aclass="reference internal" href="../glossary/index.html#term-tk"><emclass="xref std std-term">tk</em></a> 8.3 or later</dt>
<dd>The TCL/Tk widgets library used by the TkAgg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-pyqt"><emclass="xref std std-term">pyqt</em></a> 3.1 or later</dt>
<dd>The Qt3 widgets library python wrappers for the QtAgg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-pyqt"><emclass="xref std std-term">pyqt</em></a> 4.0 or later</dt>
<dd>The Qt4 widgets library python wrappers for the Qt4Agg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-pygtk"><emclass="xref std std-term">pygtk</em></a> 2.4 or later</dt>
<dd>The python wrappers for the GTK widgets library for use with the
GTK or GTKAgg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-wxpython"><emclass="xref std std-term">wxpython</em></a> 2.8 or later</dt>
<dd>The python wrappers for the wx widgets library for use with the
WX or WXAgg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-pyfltk"><emclass="xref std std-term">pyfltk</em></a> 1.0 or later</dt>
<dd>The python wrappers of the FLTK widgets library for use with FLTKAgg</dd>
</dl>
<p><strong>Required libraries that ship with matplotlib</strong></p>