@@ -19,18 +19,10 @@ The first thing to try is a :ref:`clean install <clean-install>` and see if
19
19
that helps. If not, the best way to test your install is by running a script,
20
20
rather than working interactively from a python shell or an integrated
21
21
development environment such as :program: `IDLE ` which add additional
22
- complexities. Open up a UNIX shell or a DOS command prompt and cd into a
23
- directory containing a minimal example in a file. Something like
24
- :file: `simple_plot.py ` for example::
22
+ complexities. Open up a UNIX shell or a DOS command prompt and run, for
23
+ example::
25
24
26
- import matplotlib.pyplot as plt
27
- fig, ax = plt.subplots()
28
- ax.plot([1,2,3])
29
- plt.show()
30
-
31
- and run it with::
32
-
33
- python simple_plot.py --verbose-helpful
25
+ python -c "from pylab import *; plot(); show()" --verbose-helpful
34
26
35
27
This will give you additional information about which backends matplotlib is
36
28
loading, version information, and more. At this point you might want to make
@@ -42,127 +34,46 @@ If you are still having trouble, see :ref:`reporting-problems`.
42
34
43
35
.. _clean-install :
44
36
45
- How to completely remove matplotlib
37
+ How to completely remove Matplotlib
46
38
===================================
47
39
48
- Occasionally, problems with matplotlib can be solved with a clean
49
- installation of the package.
50
-
51
- The process for removing an installation of matplotlib depends on how
52
- matplotlib was originally installed on your system. Follow the steps
53
- below that goes with your original installation method to cleanly
54
- remove matplotlib from your system.
55
-
56
- Source install
57
- --------------
58
-
59
- Unfortunately::
60
-
61
- python setup.py clean
40
+ Occasionally, problems with Matplotlib can be solved with a clean
41
+ installation of the package. In order to fully remove an installed Matplotlib:
62
42
63
- does not properly clean the build directory, and does nothing to the
64
- install directory. To cleanly rebuild:
65
-
66
- 1. Delete the caches from your :ref: `.matplotlib configuration directory
43
+ 1. Delete the caches from your :ref: `Matplotlib configuration directory
67
44
<locating-matplotlib-config-dir>`.
68
45
69
- 2. Delete the ``build `` directory in the source tree.
70
-
71
- 3. Delete any matplotlib directories or eggs from your :ref: `installation
46
+ 2. Delete any Matplotlib directories or eggs from your :ref: `installation
72
47
directory <locating-matplotlib-install>`.
73
48
74
- How to Install
75
- ==============
76
-
77
- .. _install-from-git :
78
-
79
- Source install from git
80
- -----------------------
81
-
82
- Clone the main source using one of::
83
-
84
- git clone git@github.com:matplotlib/matplotlib.git
85
-
86
- or::
87
-
88
- git clone git://github.com/matplotlib/matplotlib.git
89
-
90
- and build and install as usual with::
91
-
92
- > cd matplotlib
93
- > python setup.py install
94
-
95
- .. note ::
96
-
97
- If you are on debian/ubuntu, you can get all the dependencies
98
- required to build matplotlib with::
99
-
100
- sudo apt-get build-dep python-matplotlib
101
-
102
- If you are on Fedora/RedHat, you can get all the dependencies
103
- required to build matplotlib by first installing ``yum-builddep ``
104
- and then running::
105
-
106
- su -c "yum-builddep python-matplotlib"
107
-
108
- This does not build matplotlib, but it does get all of the
109
- build dependencies, which will make building from source easier.
110
-
111
-
112
- If you want to be able to follow the development branch as it changes
113
- just replace the last step with (make sure you have **setuptools **
114
- installed)::
115
-
116
- > python setup.py develop
117
-
118
- This creates links in the right places and installs the command
119
- line script to the appropriate places.
120
-
121
- .. note ::
122
- Mac OSX users please see the :ref: `build_osx ` guide.
123
-
124
- Windows users please see the :ref: `build_windows ` guide.
125
-
126
- Then, if you want to update your matplotlib at any time, just do::
127
-
128
- > git pull
129
-
130
- When you run `git pull `, if the output shows that only Python files have been
131
- updated, you are all set. If C files have changed, you need to run the `python
132
- setup.py develop ` command again to compile them.
133
-
134
- There is more information on :ref: `using git <using-git >` in
135
- the developer docs.
136
-
137
-
138
49
Linux Notes
139
50
===========
140
51
141
- Because most Linux distributions use some sort of package manager,
142
- we do not provide a pre-built binary for the Linux platform.
143
- Instead, we recommend that you use the "Add Software" method for
144
- your system to install matplotlib. This will guarantee that everything
145
- that is needed for matplotlib will be installed as well.
52
+ We recommend that you use your distribution's package manager to install
53
+ Matplotlib. This will guarantee that Matplotlib's dependencies will be
54
+ installed as well.
55
+
56
+ If, for some reason, you can not use the package manager, you may use the
57
+ manylinux wheels available on PyPI::
146
58
147
- If, for some reason, you can not use the package manager, Linux usually
148
- comes with at least a basic build system. Follow the :ref: `instructions
149
- <install-from-git>` found above for how to build and install matplotlib.
59
+ python -mpip install matplotlib
150
60
61
+ or :ref: `build Matplotlib from source <install-from-git >`.
151
62
152
- OS-X Notes
153
- ==========
63
+ OSX Notes
64
+ =========
154
65
155
66
.. _which-python-for-osx :
156
67
157
- Which python for OS X ?
158
- ----------------------
68
+ Which python for OSX ?
69
+ ---------------------
159
70
160
- Apple ships OS X with its own Python, in ``/usr/bin/python ``, and its own copy
161
- of matplotlib . Unfortunately, the way Apple currently installs its own copies
162
- of numpy, scipy and matplotlib means that these packages are difficult to
71
+ Apple ships OSX with its own Python, in ``/usr/bin/python ``, and its own copy
72
+ of Matplotlib . Unfortunately, the way Apple currently installs its own copies
73
+ of NumPy, Scipy and Matplotlib means that these packages are difficult to
163
74
upgrade (see `system python packages `_). For that reason we strongly suggest
164
75
that you install a fresh version of Python and use that as the basis for
165
- installing libraries such as numpy and matplotlib . One convenient way to
76
+ installing libraries such as NumPy and Matplotlib . One convenient way to
166
77
install matplotlib with other useful Python software is to use one of the
167
78
excellent Python scientific software collections that are now available:
168
79
@@ -242,20 +153,15 @@ For Python 2.7::
242
153
243
154
pip2 install matplotlib
244
155
245
- For Python 3.4 ::
156
+ For Python 3::
246
157
247
158
pip3 install matplotlib
248
159
249
- You might also want to install IPython; we recommend you install IPython with
250
- the IPython notebook option, like this:
160
+ You might also want to install IPython or the Jupyter notebook (``pip install
161
+ ipython ``, ``pip install notebook ``; for Macports and Homebrew, adapt the
162
+ command as above).
251
163
252
- * Python.org Python: ``pip install ipython[notebook] ``
253
- * Macports ``sudo pip-2.7 install ipython[notebook] `` or ``sudo pip-3.4
254
- install ipython[notebook] ``
255
- * Homebrew ``pip2 install ipython[notebook] `` or ``pip3 install
256
- ipython[notebook] ``
257
-
258
- Pip problems
164
+ pip problems
259
165
^^^^^^^^^^^^
260
166
261
167
If you get errors with pip trying to run a compiler like ``gcc `` or ``clang ``,
@@ -264,51 +170,10 @@ then the first thing to try is to `install xcode
264
170
retry the install. If that does not work, then check
265
171
:ref: `reporting-problems `.
266
172
267
- Installing via OSX mpkg installer package
268
- -----------------------------------------
269
-
270
- matplotlib also has a disk image (``.dmg ``) installer, which contains a
271
- typical Installer.app package to install matplotlib. You should use binary
272
- wheels instead of the disk image installer if you can, because:
273
-
274
- * wheels work with Python.org Python, homebrew and macports, the disk image
275
- installer only works with Python.org Python.
276
- * The disk image installer doesn't check for recent versions of packages that
277
- matplotlib depends on, and unconditionally installs the versions of
278
- dependencies contained in the disk image installer. This can overwrite
279
- packages that you have already installed, which might cause problems for
280
- other packages, if you have a pre-existing Python.org setup on your
281
- computer.
282
-
283
- If you still want to use the disk image installer, read on.
284
-
285
- .. note ::
286
- Before installing via the disk image installer, be sure that all of the
287
- packages were compiled for the same version of python. Often, the download
288
- site for NumPy and matplotlib will display a supposed 'current' version of
289
- the package, but you may need to choose a different package from the full
290
- list that was built for your combination of python and OSX.
291
-
292
- The disk image installer will have a ``.dmg `` extension, and will have a name
293
- like :file: `matplotlib-1.4.0-py2.7-macosx10.6.dmg `.
294
- The name of the installer depends on the versions of python and matplotlib it
295
- was built for, and the version of OSX that the matching Python.org installer
296
- was built for. For example, if the mathing Python.org Python installer was
297
- built for OSX 10.6 or greater, the dmg file will end in ``-macosx10.6.dmg ``.
298
- You need to download this disk image file, open the disk image file by double
299
- clicking, and find the new matplotlib disk image icon on your desktop. Double
300
- click on that icon to show the contents of the image. Then double-click on
301
- the ``.mpkg `` icon, which will have a name like
302
- :file: `matplotlib-1.4.0-py2.7-macosx10.6.mpkg `, it will run the Installer.app,
303
- prompt you for a password if you need system-wide installation privileges, and
304
- install to a directory like
305
- :file: `/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages `
306
- (exact path depends on your Python version).
307
-
308
173
Checking your installation
309
174
--------------------------
310
175
311
- The new version of matplotlib should now be on your Python "path". Check this
176
+ The new version of Matplotlib should now be on your Python "path". Check this
312
177
with one of these commands at the Terminal.app command line::
313
178
314
179
python2.7 -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__'
@@ -321,7 +186,7 @@ with one of these commands at the Terminal.app command line::
321
186
322
187
1.4.0 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc
323
188
324
- where ``1.4.0 `` is the matplotlib version you just installed, and the path
189
+ where ``1.4.0 `` is the Matplotlib version you just installed, and the path
325
190
following depends on whether you are using Python.org Python, Homebrew or
326
191
Macports. If you see another version, or you get an error like this::
327
192
@@ -340,14 +205,71 @@ or::
340
205
341
206
If you get the result ``/usr/bin/python2.7 ``, then you are getting the Python
342
207
installed with OSX, which is probably not what you want. Try closing and
343
- restarting Terminal.app before running the check again. If that doesn't fix
344
- the problem, depending on which Python you wanted to use, consider
345
- reinstalling Python.org Python, or check your homebrew or macports setup.
346
- Remember that the disk image installer only works for Python.org Python, and
347
- will not get picked up by other Pythons. If all these fail, please let us
348
- know: see :ref: ` reporting-problems `.
208
+ restarting Terminal.app before running the check again. If that doesn't fix the
209
+ problem, depending on which Python you wanted to use, consider reinstalling
210
+ Python.org Python, or check your homebrew or macports setup. Remember that
211
+ the disk image installer only works for Python.org Python, and will not get
212
+ picked up by other Pythons. If all these fail, please :ref: ` let us know
213
+ < reporting-problems> `.
349
214
350
215
Windows Notes
351
216
=============
352
217
353
218
See :ref: `installing_windows `.
219
+
220
+ .. _install-from-git :
221
+
222
+ Install from source
223
+ ===================
224
+
225
+ Clone the main source using one of::
226
+
227
+ git clone git@github.com:matplotlib/matplotlib.git
228
+
229
+ or::
230
+
231
+ git clone git://github.com/matplotlib/matplotlib.git
232
+
233
+ and build and install as usual with::
234
+
235
+ cd matplotlib
236
+ pip install .
237
+
238
+ .. note ::
239
+
240
+ If you are on Debian/Ubuntu, you can get all the dependencies required to
241
+ build Matplotlib with::
242
+
243
+ sudo apt-get build-dep python-matplotlib
244
+
245
+ If you are on Fedora/RedHat, you can get all the dependencies required to
246
+ build matplotlib by first installing ``yum-builddep `` and then running::
247
+
248
+ su -c 'yum-builddep python-matplotlib'
249
+
250
+ This does not build Matplotlib, but it does get all of the build
251
+ dependencies, which will make building from source easier.
252
+
253
+ If you want to be able to follow the development branch as it changes
254
+ just replace the last step with::
255
+
256
+ pip install -e .
257
+
258
+ This creates links and installs the command line script in the appropriate
259
+ places.
260
+
261
+ .. note ::
262
+ OSX users please see the :ref: `build_osx ` guide.
263
+
264
+ Windows users please see the :ref: `build_windows ` guide.
265
+
266
+ Then, if you want to update your matplotlib at any time, just do::
267
+
268
+ git pull
269
+
270
+ When you run ``git pull ``, if the output shows that only Python files have
271
+ been updated, you are all set. If C files have changed, you need to run ``pip
272
+ install -e . `` again to compile them.
273
+
274
+ There is more information on :ref: `using git <using-git >` in the developer
275
+ docs.
0 commit comments