44Installing
55**********
66
7- Dependencies
8- ============
9-
10- **Requirements **
7+ There are lots of different ways to install matplotlib, and the best
8+ way depends on what operating system you are using, what you already
9+ have installed, and how you want to use it. To avoid wading through
10+ all the details (and potential complications) on this page, the
11+ easiest thing for you to do is use one of the pre-packaged python
12+ distributions that already provide matplotlib built in. The Enthought
13+ Python Distribution `(EPD)
14+ <http://www.enthought.com/products/epd.php> `_ for Windows, OS X or
15+ Redhat is an excellent choice that "just works" out of the box.
16+ Another excellent alternative for Windows users is `Python (x, y)
17+ <http://www.pythonxy.com/foreword.php> `_ which tends to be updated a
18+ bit more frequently. Both of these packages include matplotlib and
19+ pylab, and *lots * of other useful tools. matplotlib is also packaged
20+ for pretty much every major linux distribution, so if you are on linux
21+ your package manager will probably provide matplotlib prebuilt.
22+
23+ One single click installer and you are done.
24+
25+ Ok, so you want to do it the hard way?
26+ ======================================
27+
28+ For some people, the prepackaged pythons discussed above are not an
29+ option. That's OK, it's usually pretty easy to get a custom install
30+ working. You will first need to find out if you have python installed
31+ on your machine, and if not, install it. The official python builds
32+ are available for download `here <http://www.python.org/download >`_,
33+ but OS X users please read :ref: `which-python-for-osx `.
34+
35+ Once you have python up and running, you will need to install `numpy
36+ <http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103> `_.
37+ numpy provides high performance array data structures and mathematical
38+ functions, and is a requirement for matplotlib. You can test your
39+ progress::
40+
41+ >>> import numpy
42+ >>> print numpy.__versions__
43+
44+ matplotlib requires numpy version 1.1 or later. Although it is not a
45+ requirement to use matplotlib, we strongly encourage you to install
46+ `ipython <http://ipython.scipy.org/dist >`_, which is an interactive
47+ shell for python that is matplotlib aware. Once you have ipython,
48+ numpy and matplotlib installed, ipython's "pylab" mode you have a
49+ matlab-like environment that automatically handles most of the
50+ configuration details for you, so you can get up and running quickly::
51+
52+ johnh@flag:~> ipython -pylab
53+ Python 2.4.5 (#4, Apr 12 2008, 09:09:16)
54+ IPython 0.9.0 -- An enhanced Interactive Python.
55+
56+ Welcome to pylab, a matplotlib-based Python environment.
57+ For more information, type 'help(pylab)'.
58+
59+ In [1]: x = randn(10000)
60+
61+ In [2]: hist(x, 100)
62+
63+ And a *voila *, a figure pops up. But we are putting the cart ahead of
64+ the horse -- first we need to get matplotlib installed. We provide
65+ prebuilt binaries for OS X and Windows on the matplotlib `download
66+ <http://sourceforge.net/project/showfiles.php?group_id=80706> `_ page.
67+ Click on the latest release of the "matplotlib" package, choose your
68+ python version (2.4 or 2.5) and your platform (macosx or win32) and
69+ you should be good to go. If you have any problems, please check the
70+ :ref: `installing-faq `, google around a little bit, and post a question
71+ the `mailing list
72+ <http://sourceforge.net/project/showfiles.php?group_id=80706> `_.
73+
74+ Note that when testing matplotlib installations from the interactive
75+ python console, there are some issues relating to user interface
76+ toolkits and interactive settings that are discussed in
77+ :ref: `mpl-shell `.
78+
79+ .. _install_from_source :
80+
81+ Installing from source
82+ ======================
83+
84+ If you are interested perhaps in contributing to matplotlib
85+ development, or just like to build everything yourself, it is not
86+ difficult to build matplotlib from source. Grab the lattest *tar.gz *
87+ release file from `sourceforge
88+ <http://sourceforge.net/project/showfiles.php?group_id=80706> `_, or if
89+ you want to develop matplotlib or just need the latest bugfixed
90+ version, grab the latest svn version :ref: `install-svn `.
91+
92+ Once you have satisfied the requirements detailed below (mainly
93+ python, numpy, libpng and freetype), you build matplotlib in the usual
94+ way::
95+
96+ cd matplotlib
97+ python setup.py build
98+ python setup.py install
99+
100+ We provide a `setup.cfg
101+ <http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/setup.cfg.template?view=markup> `
102+ file that lives along :file: `setup.py ` which you can use to customize
103+ the build process, for example, which default backend to use, whether
104+ some of the optional libraries that matplotlib ships with are
105+ installed, and so on. This file will be particularly useful to those
106+ packaging matplotlib.
107+
108+
109+ .. _install_requrements :
110+
111+ Build requirements
112+ ==================
11113
12114These are external packages which you will need to install before
13115installing matplotlib. Windows users only need the first two (python
@@ -18,12 +120,14 @@ installers available for download at the sourceforge site.
18120 matplotlib requires python 2.4 or later (`download <http://www.python.org/download/ >`__)
19121
20122:term: `numpy ` 1.1 (or later)
21- array support for python (`download <http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 >`__)
123+ array support for python (`download
124+ <http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103> `__)
22125
23126libpng 1.1 (or later)
24- library for loading and saving :term: `PNG ` files (`download <http://www.libpng.org/pub/png/libpng.html >`__). libpng requires zlib. If
25- you are a windows user, you can ignore this since we build support
26- into the matplotlib single click installer
127+ library for loading and saving :term: `PNG ` files (`download
128+ <http://www.libpng.org/pub/png/libpng.html> `__). libpng requires
129+ zlib. If you are a windows user, you can ignore this since we
130+ build support into the matplotlib single click installer
27131
28132:term: `freetype ` 1.4 (or later)
29133 library for reading true type font files. If you are a windows
@@ -60,32 +164,22 @@ backends and the capabilities they provide
60164
61165**Required libraries that ship with matplotlib **
62166
63- If you are downloading matplotlib or installing from source or
64- subversion, you can ignore this section. This is useful for matplotlib
65- developers and packagers who may want to disable the matplotlib
66- version and ship a packaged version.
67-
68167:term: `agg ` 2.4
69- The antigrain C++ rendering engine
168+ The antigrain C++ rendering engine. matplotlib links against the
169+ agg template source statically, so it will not affect anything on
170+ your system outside of matplotlib.
70171
71172pytz 2007g or later
72- timezone handling for python datetime objects
173+ timezone handling for python datetime objects. By default,
174+ matplotlib will install pytz if it isn't already installed on your
175+ system. To override the default, use setup.cfg to force or
176+ prevent installation of pytz.
73177
74178dateutil 1.1 or later
75- extensions to python datetime handling
76-
77- **Optional libraries that ship with matplotlib **
78-
79- As above, if you are downloading matplotlib or installing from source
80- or subversion, you can ignore this section. This is useful for
81- matplotlib developers and packagers who may want to disable the
82- matplotlib version and ship a packaged version.
83-
84- enthought traits 2.6
85- The traits component of the Enthought Tool Suite used in the
86- experimental matplotlib traits rc system. matplotlib has decided
87- to stop installing this library so packagers should not distribute
88- the version included with matplotlib. packagers do not need to
89- list this as a requirement because the traits support is
90- experimental and disabled by default.
179+ extensions to python datetime handling. By
180+ default, matplotlib will install dateutil if it isn't already
181+ installed on your system. To override the default, use setup.cfg
182+ to force or prevent installation of dateutil.
183+
184+
91185
0 commit comments