Menu

[r8866]: / trunk / htdocs / installing.html.template  Maximize  Restore  History

Download this file

175 lines (139 with data), 7.1 kB

@header@ 
<h2>Installing matplotlib</h2>

matplotlib requires at a minimum python 2.3, numpy, freetype and
libpng.  To get the most out of matplotlib, you will want to build
some of the optional GUI and image extensions, discussed
below. Matplotlib is known to work on linux, unix, win32 and OS X
platforms.<p>

There are two kinds of matplotlib backends: vector based and raster
based.  The vector based backends, SVG and PS, produce ASCII text
output files *.svg and *.ps; the PDF backend roduces a binary *.pdf
output files.  The core raster based renderer is the
<a href=http://antigrain.com>antigrain</a> (agg) backend.  This is a
high quality 2D library that supports fast antialiasing, alpha
blending and much more.  If you want to produce PNGs or GUI images
that support all of matplotlib's features, you should compile
matplotlib with agg support and use one of the GUI agg backends as
described below: GTKAgg, WXAgg, TkAgg or FLTKAgg.  All of these
features are included in the windows installer<p>

<h2><a name=compiling>Compiling</a></h2>

You probably don't need to compile matplotlib unless you want to or
work on an obscure platform.  There are binary builds for Windows, OS
X and many major linux distributions; see below.  If you do want to
compile, read on.<p>

You will need to have recent versions of freetype, libpng and zlib
installed on your system.  If you are using a package manager, also
make sure the devel versions of these packages are also installed (eg
freetype-devel).<p>

  matplotlib ships with a setup.cfg.template which you can use to
  customize the build process.  Copy it to setup.cfg if you need to
  customize something.  See that files for details of the parameters
  you can set.<p>

  If you want to use a GUI backend, you will need either Tkinter,
  pygtk , wxPython or Qt installed on your system, from src or from a
  package manager including the devel packages.  You can choose which
  backends to enable by setting the flags in setup.cfg, but the default
  is to automatically detect your installed GUIs and build support for
  them.  If you later find that you did not have a GUI toolkit like
  pygtk installed when you built matplotlib, but now want it, you will
  need to install the toolkit and rebuild matplotlib.<p>

  If you have installed prerequisites to nonstandard places and need
  to inform matplotlib where they are, edit setupext.py an add the
  base dirs to the 'basedir' dictionary entry for your sys.platform.
  Eg, if the header to some required library is in
  /some/path/include/somheader.h, put /some/path in the basedir list
  for your platform.<p>

<pre>
      python setup.py build
      python setup.py install
</pre>
    
There are many defaults that you can control in matplotlib in the <a
href=matplotlibrc>matplotlibrc</a> file. 

<h2><a name=windows>Windows</a></h2>

If you don't already have python installed, you may want to consider
using the enthought edition of python, which has numpy, scipy, and
wxpython, plus a lot of other goodies, preinstalled -
<a 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>

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
<a href=http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71>msvcp71.dll</a>
library.  You will need to unzip the archive and drag the dll into
c:\windows\system32


With a standard python + numpy + matplotlib, the following backends
should work on windows: agg, tkagg, ps, pdf, an svg.  If you want
others, eg a wx, wxagg, gtk or gtkagg, you'll need to install the
requisite GUI toolkits, such as wxPython.

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 (*.exe or *.egg) on the download page contains all the code
you need to get up and running.  However, there are many <a
href=examples>examples</a> that are not included in the windows
installer.  If you want to try the many demos that come in the
matplotlib src distribution, download the zip file and look in the
examples subdir.<p>

<i>Important: There are known conflicts with some of the backends with
some python IDEs such as pycrust, idle.  If you want to use matplotlib
from an IDE, please consult <a
href=backends.html>backends</a> for
compatibility information.  You will have the greatest likelihood of
success if you run the examples from the command shell or by double
clicking on them, rather than from an IDE.  If you are interactively
generating plots, your best bet is TkAgg from the standard python
shell or ipython.</i>

<h3><a name=osx>OS X</a></h3>

All of the backends run on OS X.  We build universal binary eggs for
OS X that should work on Tiger (10.4) and Leopard (10.5) for both
intel and PPC architectures, which you can grab
<a href=http://sourceforge.net/project/platformdownload.php?group_id=80706>here</a>.
If you are interested in building your own binaries, you can read the
build notes
<a href=http://ipython.scipy.org/moin/MatplotlibOSXBuildNotes>here</a>.
If you want to build from svn yourself on OS X, make sure you read the
compiling instructions above.  There is a wiki page that covers build
matplotlib (and other scientific python packages) from svn at
<a href=http://ipython.scipy.org/moin/Py4Science/InstallationOSX>InstallationOSX</a> <p>

Note when running a GUI backend in OSX, you should launch your
programs with pythonw rather than python, or you may get
nonresponsive GUIs.

<h2>Package Managers: (rpms, apt, fink)</h2>

<h3><a name=rpms>RPMS</a></h3>

To build all the backends on a binary linux distro such as redhat, you
need to install a number of the devel libs (and whatever dependencies
they require), I suggest
<ul> 
	
  <li>matplotlib core: zlib, zlib-devel, libpng, libpng-devel,
      freetype, freetype-devel, freetype-utils</li>

  <li>gtk/gtkagg backend: gtk2-devel, gtk+-devel, pygtk2, glib-devel,
      pygtk2-devel, gnome-libs-devel, pygtk2-libglade</li>

  <li>tk backend: tcl, tk, tkinter</li>

  <li>wx/wxagg backends - the wxpython rpms from <a
  href=http://wxpython.org</a>wxpython</a></li>

</ul>

<h3><a name=debian>Debian</a></h3>

Vittorio Palmisano <redclay@email.it> maintails the debian
packages 

<ul>
    <li> add these lines to your /etc/apt/sources.list: 
<pre>
  deb http://anakonda.altervista.org/debian packages/
  deb-src http://anakonda.altervista.org/debian sources/
</pre> 
    </li>
   
      <li> then run:
<pre>   
  # apt-get update
  # apt-get install python-matplotlib python-matplotlib-doc
</pre>         
  </li>
</ul>


<h3><a name=fink>Fink</a></h3>

fink users should use Jeffrey Whitaker's fink distribution, which
supports the GTK, TkAgg, GTKAgg, PS, WX, WXAgg and Agg backends. See
<a
href=http://fink.sourceforge.net/pdb/package.php/matplotlib-py23>matplotlib
fink</a>
@footer@
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.