Skip to content

Commit 0769c6a

Browse files
committed
DOC: comprehensive rewrite of OSX install docs
Katy's recent edits were a big improvement, but the faq install instructions for OSX had also got horribly out of date. The main thing that has changed is that wheels are now the default binary installation format, and, even if we are going to provide eggs, no-one should be using easy_install now.
1 parent 2d86ce6 commit 0769c6a

File tree

2 files changed

+177
-82
lines changed

2 files changed

+177
-82
lines changed

INSTALL

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,36 @@ Installing
99
There are many different ways to install matplotlib, and the best way
1010
depends on what operating system you are using, what you already have
1111
installed, and how you want to use it. To avoid wading through all
12-
the details (and potential complications) on this page, the easiest
13-
thing for you to do is use one of the pre-packaged python
14-
distributions that already provide matplotlib built-in. The Continuum.io
15-
Python distribution `(Anaconda)
16-
<https://store.continuum.io/cshop/anaconda/>`_ and the Enthought
17-
distribution `(Canopy) <https://www.enthought.com/products/canopy/>`_
18-
are both excellent choices that "just work" out of the box for any
19-
platform. Both of these packages include matplotlib and
20-
*lots* of other useful tools.
21-
Another excellent alternative for Windows users is `Python (x, y)
22-
<https://code.google.com/p/pythonxy>`_ . matplotlib is also packaged for almost
23-
every major Linux distribution. So if you are on Linux, your package
24-
manager will probably provide matplotlib prebuilt.
12+
the details (and potential complications) on this page, there are several
13+
convenient options.
14+
15+
Most platforms : scientific Python distributions
16+
================================================
17+
18+
The first option is to use one of the pre-packaged python distributions that
19+
already provide matplotlib built-in. The Continuum.io Python distribution
20+
`(Anaconda) <https://store.continuum.io/cshop/anaconda/>`_ and the Enthought
21+
distribution `(Canopy) <https://www.enthought.com/products/canopy/>`_ are both
22+
excellent choices that "just work" out of the box for Windows, OSX and common
23+
Linux platforms. Both of these distributions include matplotlib and *lots* of
24+
other useful tools. Another excellent alternative for Windows users is
25+
`Python (x, y) <https://code.google.com/p/pythonxy>`_ .
26+
27+
Linux : using your package manager
28+
==================================
29+
30+
If you are on Linux, you might prefer to use your package manager. matplotlib
31+
is packaged for almost every major Linux distribution.
32+
33+
* Debian / Ubuntu : ``sudo apt-get install python-matplotlib``
34+
* Fedora / Redhat : ``sudo yum install python-matplotlib``
35+
36+
Mac OSX - using pip
37+
===================
38+
39+
If you are on Mac OSX you can probably install matplotlib binaries using the
40+
standard Python installation program `pip <https://pypi.python.org/pip>`_.
41+
See :ref:`installing-osx-binaries`.
2542

2643
Manually installing pre-built packages
2744
======================================
@@ -36,7 +53,7 @@ on your machine, and if not, install it. The official python builds
3653
are available for download `here <http://www.python.org/download>`_,
3754
but OS X users please read :ref:`which-python-for-osx`.
3855

39-
Once you have python up and running, you will need to install `numpy
56+
Once you have Python up and running, you will need to install `numpy
4057
<http://www.numpy.org/>`_. numpy provides high-performance array data
4158
structures and mathematical functions, and is a requirement for
4259
matplotlib. You can test your progress::
@@ -87,7 +104,6 @@ python console, there are some issues relating to user interface
87104
toolkits and interactive settings that are discussed in
88105
:ref:`mpl-shell`.
89106

90-
91107
Installing on Windows
92108
---------------------
93109

@@ -207,7 +223,7 @@ manager on Linux, you may need to install the development packages
207223

208224
.. note::
209225

210-
If you are on debian/ubuntu, you can get all the dependencies
226+
If you are on Debian/Ubuntu, you can get all the dependencies
211227
required to build matplotlib with::
212228

213229
sudo apt-get build-dep python-matplotlib

doc/faq/installing_faq.rst

Lines changed: 145 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
Installation
55
*************
66

7-
87
.. contents::
98
:backlinks: none
109

11-
1210
Report a compilation problem
1311
============================
1412

@@ -181,12 +179,14 @@ OS-X Notes
181179
Which python for OS X?
182180
----------------------
183181

184-
Apple ships OS X with its own python, but it is generally recommended
185-
that users install an independent python system and use that
186-
as the basis for installing libraries such as numpy and
187-
matplotlib. By far the easiest method is to use one
188-
of the excellent python software collections that are now
189-
available:
182+
Apple ships OS X with its own Python, in ``/usr/bin/python``, and its own copy
183+
of matplotlib. Unfortunately, the way Apple currently installs its own copies
184+
of numpy, scipy and matplotlib means that these packages are difficult to
185+
upgrade. For that reason we strongly suggest that you install a fresh version
186+
of Python and use that as the basis for installing libraries such as numpy and
187+
matplotlib. Once convenient way to install matplotlib with other useful
188+
Python software is to use one of the excellent Python scientific software
189+
collections that are now available:
190190

191191
- Anaconda_ from `Continuum Analytics`_
192192
- Canopy_ from Enthought_
@@ -196,94 +196,173 @@ available:
196196
.. _Enthought: http://enthought.com
197197
.. _Continuum Analytics: http://continuum.io
198198

199-
These collections include python itself and a wide range of
200-
libraries; if you need a library that is not available from
201-
the collection, you can install it yourself using standard
202-
methods such as *pip*.
199+
These collections include Python itself and a wide range of libraries; if you
200+
need a library that is not available from the collection, you can install it
201+
yourself using standard methods such as *pip*. Continuum and Enthought offer
202+
their own installation support for these collections; see the Ananconda and
203+
Canopy web pages for more information.
204+
205+
Other options for a fresh Python install are the standard installer from
206+
`python.org <https://www.python.org/downloads/mac-osx/>`_, or installing
207+
Python using a general OSX package management system such as `homebrew
208+
<http://brew.sh>`_ or `macports <http://www.macports.org>`_. Power users on
209+
OSX will likely want one of homebrew or macports on their system to install
210+
open source software packages, but it is perfectly possible to use these
211+
systems with another source for your Python binary, such as Anaconda, Canopy
212+
or Python.org Python.
203213

204-
If you choose not to use a collection, then you may use an
205-
installer from `python.org
206-
<https://www.python.org/downloads/mac-osx/>`_, or use a
207-
general package management system such as `homebrew
208-
<http://brew.sh>`_ or `macports <http://www.macports.org>`_.
209-
Whatever you choose, choose one and stick with it--don't try
210-
to mix homebrew and macports, for example. You may,
211-
however, use homebrew or macports for all your non-python
212-
software, and still use Anaconda_ or Canopy_ for your python
213-
system.
214+
.. _install_osx_binaries:
214215

216+
Installing OSX binary wheels
217+
----------------------------
215218

219+
If you are using recent Python from http://www.python.org, Macports or
220+
Homebrew, then you can use the standard pip installer to install matplotlib
221+
binaries in the form of wheels.
216222

217-
.. _install_osx_binaries:
223+
Python.org Python
224+
^^^^^^^^^^^^^^^^^
218225

219-
Installing OSX binaries
220-
-----------------------
226+
* Install pip following instructions here: http://pip.readthedocs.org
227+
228+
Then::
229+
230+
pip install matplotlib
231+
232+
Macports
233+
^^^^^^^^
234+
235+
For Python 2.7::
236+
237+
sudo port install py27-pip
238+
sudo pip-2.7 install matplotlib
239+
240+
For Python 3.4::
241+
242+
sudo port install py34-pip
243+
sudo pip-3.4 install matplotlib
244+
245+
Homebrew
246+
^^^^^^^^
247+
248+
For Python 2.7::
249+
250+
pip2 install matplotlib
251+
252+
For Python 3.4::
221253

222-
If you want to install matplotlib from one of the binary installers we
223-
build, you have two choices: a mpkg installer, which is a typical
224-
Installer.app, or a binary OSX egg, which you can install via
225-
setuptools' easy_install.
254+
pip3 install matplotlib
255+
256+
You might also want to install IPython; we recommend you install IPython with
257+
the IPython notebook option, like this:
258+
259+
* Python.org Python: ``pip install ipython[notebook]``
260+
* Macports ``sudo pip-2.7 install ipython[notebook]`` or ``sudo pip-3.4
261+
install ipython[notebook]``
262+
* Homebrew ``pip2 install ipython[notebook]`` or ``pip3 install
263+
ipython[notebook]``
264+
265+
Installing via OSX mpkg installer package
266+
-----------------------------------------
267+
268+
matplotlib also has a disk image (``.dmg``) installer, which contains a
269+
typical Installer.app package to install matplotlib. You should use binary
270+
wheels instead of the disk image installer if you can, because:
271+
272+
* wheels work with Python.org Python, homebrew and macports, the disk image
273+
installer only works with Python.org Python.
274+
* The disk image installer doesn't check for recent versions of packages that
275+
matplotlib depends on, and unconditionally installs the versions of
276+
dependencies contained in the disk image installer. This can overwrite
277+
packages that you have already installed, which might cause problems for
278+
other packages, if you have a pre-existing Python.org setup on your
279+
computer.
280+
281+
If you still want to use the disk image installer, read on.
226282

227283
.. note::
228-
Before installing any of the binary packages, be sure that all of the
229-
packages were compiled for the same version of python.
230-
Often, the download site for NumPy and matplotlib will display a
231-
supposed 'current' version of the package, but you may need to choose
232-
a different package from the full list that was built for your
233-
combination of python and OSX.
234-
235-
The mkpg installer will have a "zip" extension, and will have a name
236-
like :file:`matplotlib-1.2.0-py2.7-macosx10.5_mpkg.zip`.
284+
Before installing via the disk image installer, be sure that all of the
285+
packages were compiled for the same version of python. Often, the download
286+
site for NumPy and matplotlib will display a supposed 'current' version of
287+
the package, but you may need to choose a different package from the full
288+
list that was built for your combination of python and OSX.
289+
290+
The disk image installer will have a ``.dmg`` extension, and will have a name
291+
like :file:`matplotlib-1.4.0-py2.7-macosx10.5.dmg`.
237292
The name of the installer depends on which versions of python, matplotlib,
238-
and OSX it was built for. You need to unzip this file using either the
239-
"unzip" command, or simply double clicking on the it. Then when you
240-
double-click on the resulting mpkd, which will have a name like
241-
:file:`matplotlib-1.2.0-py2.7-macosx10.5.mpkg`, it will run the
242-
Installer.app, prompt you for a password if you need system-wide
293+
and OSX it was built for. You need to download this disk image ``.dmg``
294+
file. Next open the disk image file by double clicking, and find the new
295+
matplotlib disk image icon on your desktop. Double click on that icon to show
296+
the contents of the image. Then double-click on the ``.mpkg`` icon, which
297+
will have a name like :file:`matplotlib-1.4.0-py2.7-macosx10.5.mpkg`, it will
298+
run the Installer.app, prompt you for a password if you need system-wide
243299
installation privileges, and install to a directory like
244-
:file:`/Library/Python/2.7/site-packages/` (exact path depends on your
245-
python version). This directory may not be in your python 'path' variable,
246-
so you should test your installation with::
300+
:file:`/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages`
301+
(exact path depends on your Python version).
302+
303+
Checking your installation
304+
--------------------------
305+
306+
The new version of matplotlib should now be on your Python "path". Check this
307+
with one of these commands at the Terminal.app command line::
247308

248-
> python -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__'
309+
python2.7 -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__'
249310

250-
If you get an error like::
311+
(Python 2.7) or::
312+
313+
python3.4 -c 'import matplotlib; print(matplotlib.__version__, matplotlib.__file__)'
314+
315+
(Python 3.4). You should see something like this::
316+
317+
1.4.0 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc
318+
319+
where ``1.4.0`` is the matplotlib version you just installed, and the path
320+
following depends on whether you are using Python.org Python, Homebrew or
321+
Macports. If you see another version, or you get an error like this::
251322

252323
Traceback (most recent call last):
253324
File "<string>", line 1, in <module>
254325
ImportError: No module named matplotlib
255326

256-
then you will need to set your PYTHONPATH, eg::
327+
then check that the Python binary is the one you expected by doing one of
328+
these commands in Terminal.app::
257329

258-
export PYTHONPATH=/Library/Python/2.7/site-packages:$PYTHONPATH
330+
which python2.7
259331

260-
See also ref:`environment-variables`.
332+
or::
333+
334+
which python3.4
261335

336+
If you get the result ``/usr/bin/python2.7``, then you are getting the Python
337+
installed with OSX, which is probably not what you want. Try closing and
338+
restarting Terminal.app before running the check again. If that doesn't fix
339+
the problem, depending on which Python you wanted to use, consider
340+
reinstalling Python.org Python, or check your homebrew or macports setup.
341+
Remember that the disk image installer only works for Python.org Python, and
342+
will not get picked up by other Pythons. If all these fail, please contact
343+
the mailing list.
262344

263345
Windows Notes
264346
=============
265347

266-
Recommendation: use one of the excellent multi-platform
267-
python collections which include python itself and a wide
268-
range of libraries including matplotlib:
348+
We recommend you use one of the excellent python collections which include
349+
Python itself and a wide range of libraries including matplotlib:
269350

270351
- Anaconda_ from `Continuum Analytics`_
271352
- Canopy_ from Enthought_
353+
- `Python (x, y) <https://code.google.com/p/pythonxy>`_
272354

273-
A Windows-only alternative is:
274-
275-
- `python (x, y) <http://www.pythonxy.com>`_
355+
Python (X, Y) is Windows-only, whereas Anaconda and Canopy are cross-platform.
276356

277357
.. _windows-installers:
278358

279-
Binary installers for Windows
280-
-----------------------------
359+
Standalone binary installers for Windows
360+
----------------------------------------
281361

282-
If you have already installed python, you can use one of the
362+
If you have already installed Python and numpy, you can use one of the
283363
matplotlib binary installers for windows -- you can get these from the
284-
`download <http://matplotlib.org/downloads.html>`_ site.
285-
Choose the files that match your version of python (eg ``py2.7`` if
286-
you installed Python 2.7) which have the ``exe`` extension. If you
287-
haven't already installed python, you can get the official version
288-
from the `python web site <http://python.org/download/>`_.
289-
364+
`download <http://matplotlib.org/downloads.html>`_ site. You will first need
365+
to install Choose the files that match your version of python (eg ``py2.7`` if
366+
you installed Python 2.7) which have the ``exe`` extension. If you haven't
367+
already installed python, you can get the official version from the `python
368+
web site <http://python.org/download/>`_.

0 commit comments

Comments
 (0)