forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
339 lines (261 loc) · 13 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
.. The source of this document is INSTALL. During the doc build process,
.. this file is copied over to doc/users/installing.rst.
.. Therefore, you must edit INSTALL, *not* doc/users/installing.rst!
**********
Installing
**********
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, there are several
convenient options.
Most platforms : scientific Python distributions
================================================
The first option is to use one of the pre-packaged python distributions that
already provide matplotlib built-in. The Continuum.io Python distribution
`(Anaconda) <https://store.continuum.io/cshop/anaconda/>`_ and the Enthought
distribution `(Canopy) <https://www.enthought.com/products/canopy/>`_ are both
excellent choices that "just work" out of the box for Windows, OSX and common
Linux platforms. Both of these distributions include matplotlib and *lots* of
other useful tools. Another excellent alternative for Windows users is
`Python (x, y) <https://code.google.com/p/pythonxy>`_ .
Linux : using your package manager
==================================
If you are on Linux, you might prefer to use your package manager. matplotlib
is packaged for almost every major Linux distribution.
* Debian / Ubuntu : ``sudo apt-get install python-matplotlib``
* Fedora / Redhat : ``sudo yum install python-matplotlib``
Mac OSX - using pip
===================
If you are on Mac OSX you can probably install matplotlib binaries using the
standard Python installation program `pip <https://pypi.python.org/pip>`_.
See :ref:`installing-osx-binaries`.
Manually installing pre-built packages
======================================
General instructions
--------------------
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 `here <http://www.python.org/download>`_,
but OS X users please read :ref:`which-python-for-osx`.
Once you have Python up and running, you will need to install `numpy
<http://www.numpy.org/>`_. numpy provides high-performance array data
structures and mathematical functions, and is a requirement for
matplotlib. You can test your progress::
>>> import numpy
>>> print numpy.__version__
matplotlib requires numpy version |minimum_numpy_version| or later.
Although it is not a requirement to use matplotlib, we strongly
encourage you to install `ipython <http://ipython.org>`_, which is an
interactive shell for python that is matplotlib-aware.
Next, we need to get matplotlib installed. We provide prebuilt
binaries for OS X and Windows on the matplotlib `download
<http://matplotlib.org/downloads.html>`_. Click on
the latest release of the "matplotlib" package, choose your python
version (2.6, 2.7, 3.3, or 3.4) and your platform (macosx or win32). If you
have any problems, please check the :ref:`installing-faq`, search
using Google, and/or post a question the `mailing list
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_.
If you are on Debian/Ubuntu linux, it suffices to do::
> sudo apt-get install python-matplotlib
Instructions for installing our OSX binaries are found in the FAQ
:ref:`install_osx_binaries`.
Once you have ipython, numpy and matplotlib installed, you can use
ipython's "pylab" mode to have a MATLAB-like environment that automatically
handles most of the configuration details for you, so you can get up
and running quickly::
johnh@flag:~> ipython -pylab
Python 2.4.5 (#4, Apr 12 2008, 09:09:16)
IPython 0.9.0 -- An enhanced Interactive Python.
Welcome to pylab, a matplotlib-based Python environment.
For more information, type 'help(pylab)'.
In [1]: x = randn(10000)
In [2]: hist(x, 100)
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
:ref:`mpl-shell`.
Installing on Windows
---------------------
If you don't already have Python installed, we recommend using
one of the `scipy-stack compatible Python distributions
<http://www.scipy.org/install.html>`_ such as Python(x,y),
Enthought Canopy, or Continuum Anaconda, which have matplotlib and
many of its dependencies, plus other useful packages, preinstalled.
For `standard Python <http://www.python.org/download/>`_ installations
you will also need to install compatible versions of
`setuptools <https://pypi.python.org/pypi/setuptools/>`_,
`numpy <https://pypi.python.org/pypi/numpy/>`_,
`python-dateutil <https://pypi.python.org/pypi/python-dateutil/>`_,
`pytz <https://pypi.python.org/pypi/pytz>`_,
`pyparsing <https://pypi.python.org/pypi/pyparsing/>`_ and
`six <https://pypi.python.org/pypi/six>`_
in addition to
`matplotlib <https://pypi.python.org/pypi/matplotlib>`_.
In case Python is not installed for all users (not the default), the
Microsoft Visual C++ 2008 (
`64 bit <http://www.microsoft.com/download/en/details.aspx?id=15336>`_
or
`32 bit <http://www.microsoft.com/download/en/details.aspx?id=29>`_
for Python 2.6 to 3.2) or Microsoft Visual C++ 2010 (
`64 bit <http://www.microsoft.com/en-us/download/details.aspx?id=14632>`_
or
`32 bit <http://www.microsoft.com/en-us/download/details.aspx?id=5555>`_
for Python 3.3 and 3.4) redistributable packages need to be installed.
Matplotlib depends on `Pillow <https://pypi.python.org/pypi/Pillow>`_
for reading and saving JPEG, BMP, and TIFF image files.
Matplotlib requires `MiKTeX <http://miktex.org/>`_ and
`GhostScript <http://www.ghostscript.com/download/>`_ for rendering text
with LaTeX.
`FFmpeg <https://www.ffmpeg.org/>`_, `avconv <https://libav.org/>`_,
`mencoder <http://www.mplayerhq.hu>`_, or
`ImageMagick <http://www.imagemagick.org/>`_ are required for the
animation module.
The following backends should work out of the box: agg, tkagg, ps,
pdf and svg.
For other backends you may need to install
`pycairo <https://pypi.python.org/pypi/pycairo>`_,
`PyQt4 <https://pypi.python.org/pypi/PyQt4>`_,
`PyQt5 <https://pypi.python.org/pypi/PyQt5>`_,
`PySide <https://pypi.python.org/pypi/PySide>`_,
`wxPython <https://pypi.python.org/pypi/wxPython>`_,
`PyGTK <https://pypi.python.org/pypi/PyGTK>`_,
`Tornado <https://pypi.python.org/pypi/tornado>`_,
or GhostScript.
TkAgg is probably the best backend for interactive use from the
standard Python shell or IPython. It is enabled as the default backend
for the official binaries. GTK3 is not supported on Windows.
The Windows installers (:file:`*.exe`) and wheels (:file:`*.whl`) on
the download page do not contain test data or example code.
If you want to try the many demos that come in the matplotlib source
distribution, download the zip file and look in the :file:`examples`
subdirectory.
To run the test suite, copy the lib\matplotlib\tests and
lib\mpl_toolkits\tests directories from the source distribution to
sys.prefix\Lib\site-packages\matplotlib and
sys.prefix\Lib\site-packages\mpl_toolkits respectively, and install
`nose <https://pypi.python.org/pypi/nose>`_,
`mock <https://pypi.python.org/pypi/mock>`_,
Pillow, MiKTeX, GhostScript, ffmpeg, avconv, mencoder, ImageMagick, and
`Inkscape <http://inkscape.org/>`_.
.. _install_from_source:
Installing from source
======================
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 *tar.gz* release file from `the download page
<http://matplotlib.org/downloads.html>`_, or if you want
to develop matplotlib or just need the latest bugfixed version, grab
the latest git version :ref:`install-from-git`.
Once you have satisfied the requirements detailed below (mainly
python, numpy, libpng and freetype), you can build matplotlib::
cd matplotlib
python setup.py build
python setup.py install
We provide a `setup.cfg
<https://github.com/matplotlib/matplotlib/raw/master/setup.cfg.template>`_
file that goes with :file:`setup.py` 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.
If you have installed prerequisites to nonstandard places and need to
inform matplotlib where they are, edit ``setupext.py`` and add the base
dirs to the ``basedir`` dictionary entry for your ``sys.platform``.
e.g., if the header to some required library is in
``/some/path/include/someheader.h``, put ``/some/path`` in the
``basedir`` list for your platform.
.. _install_requirements:
Build requirements
==================
These are external packages which you will need to install before
installing matplotlib. If you are building on OSX, see
:ref:`build_osx`. 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.
.. note::
If you are on Debian/Ubuntu, you can get all the dependencies
required to build matplotlib with::
sudo apt-get build-dep python-matplotlib
If you are on Fedora/RedHat, you can get all the dependencies
required to build matplotlib by first installing ``yum-builddep``
and then running::
su -c "yum-builddep python-matplotlib"
This does not build matplotlib, but it does get the install the
build dependencies, which will make building from source easier.
:term:`python` 2.6, 2.7, 3.1 or 3.2
`Download python <http://www.python.org/download/>`_.
:term:`numpy` |minimum_numpy_version| (or later)
array support for python (`download numpy <http://numpy.org>`_)
:term:`dateutil` 1.1 or later
Provides extensions to python datetime handling. If using pip,
easy_install or installing from source, the installer will attempt
to download and install `python_dateutil` from PyPI. Note that
`python_dateutil` also depends on `six`. `pip` and other package
managers should handle installing that secondary dependency
automatically.
`pyparsing`
Required for matplotlib's mathtext math rendering support. If
using pip, easy_install or installing from source, the installer
will attempt to download and install `pyparsing` from PyPI.
six 1.3 or later
Python 2/3 compatibility library. This is also a dependency of
:term:`dateutil`.
libpng 1.2 (or later)
library for loading and saving :term:`PNG` files (`download
<http://www.libpng.org/pub/png/libpng.html>`__). libpng requires
zlib. If you are a Windows user, you can ignore this because we
build support into the matplotlib single-click installer
**Optional GUI frameworks**
These are optional packages which you may want to install to use
matplotlib with a user interface toolkit. See
:ref:`what-is-a-backend` for more details on the optional matplotlib
backends and the capabilities they provide.
:term:`tk` 8.3 or later
The TCL/Tk widgets library used by the TkAgg backend
:term:`pyqt` 4.0 or later
The Qt4 widgets library python wrappers for the Qt4Agg backend
:term:`pygtk` 2.4 or later
The python wrappers for the GTK widgets library for use with the
GTK or GTKAgg backend
:term:`wxpython` 2.8 or later
The python wrappers for the wx widgets library for use with the
WX or WXAgg backend
**Optional external programs**
ffmpeg/avconv or mencoder
Required for the animation module to be save out put to movie
formats.
ImageMagick
Required for the animation module to be able to save to animated gif.
**Optional dependencies**
`Pillow http://python-imaging.github.io/`__
If Pillow is installed, matplotlib can read and write a larger
selection of image file formats.
:term:`freetype` 1.4 (or later)
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.
**Required libraries that ship with matplotlib**
:term:`agg` 2.4
The antigrain C++ rendering engine. matplotlib links against the
agg template source statically, so it will not affect anything on
your system outside of matplotlib.
`PyCXX` 6.2.4
A library for writing Python extensions in C++.
`qhull` 2012.1
A library for computing convex hulls. Used for computing triangulation
and meshes.
`ttconv`
truetype font utility
.. _build_osx:
Building on OSX
===============
The build situation on OSX is complicated by the various places one
can get the libpng and freetype requirements (darwinports, fink,
/usr/X11R6) and the different architectures (e.g., x86, ppc, universal) and
the different OSX version (e.g., 10.4 and 10.5). We recommend that you build
the way we do for the OSX release: get the source from the tarball or the
git repository and follow the instruction in :file:`README.osx`.