Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0acf41e

Browse files
committed
DOC refactored installation instruction
1 parent 2063e81 commit 0acf41e

File tree

4 files changed

+107
-108
lines changed

4 files changed

+107
-108
lines changed

INSTALL

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
.. Therefore, you must edit INSTALL, *not* doc/users/installing.rst!
44
.. _pip: https://pypi.python.org/pypi/pip/
55

6-
**********
6+
==========
77
Installing
8-
**********
8+
==========
99

1010
There are many different ways to install matplotlib, and the best way
1111
depends on what operating system you are using, what you already have
@@ -325,7 +325,32 @@ can get the libpng and freetype requirements (darwinports, fink,
325325
/usr/X11R6) and the different architectures (e.g., x86, ppc, universal) and
326326
the different OSX version (e.g., 10.4 and 10.5). We recommend that you build
327327
the way we do for the OSX release: get the source from the tarball or the
328-
git repository and follow the instruction in :file:`README.osx`.
328+
git repository and install the required dependencies through a third-party
329+
package manager: two widely used package managers are homebrew, and MacPorts.
330+
The following example illustrates how to install libpng and freetype using
331+
brew:
332+
333+
Example usage::
334+
335+
brew install libpng freetype pkg-config
336+
337+
If you are using MacPorts, execute the following instead:
338+
339+
Example usage::
340+
341+
port install libpng freetype pkgconfig
342+
343+
To install matplotlib from source, execute:
344+
345+
Example usage::
346+
347+
python setup.py install
348+
349+
350+
Note that your environment is somewhat important. Some conda users have
351+
found that, to run the tests, their PYTHONPATH must include
352+
/path/to/anaconda/.../site-packages and their DYLD_FALLBACK_LIBRARY_PATH
353+
must include /path/to/anaconda/lib.
329354

330355

331356
.. _build_windows:
@@ -341,3 +366,71 @@ with the same compiler.
341366
Since there is no canonical Windows package manager, the methods for building
342367
freetype, zlib, and libpng from source code are documented as a build script
343368
at `matplotlib-winbuild <https://github.com/jbmohler/matplotlib-winbuild>`_.
369+
370+
371+
There are a few possibilities to build matplotlib on Windows:
372+
373+
* Wheels via `matplotlib-winbuild <https://github.com/jbmohler/matplotlib-winbuild>`_
374+
* Wheels by using conda packages
375+
* Conda packages
376+
377+
Wheel builds using conda packages
378+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
379+
380+
This is a wheel build, but we use conda packages to get all the requirements. The binary
381+
requirements (png, freetype,...) are statically linked and therefore not needed during the wheel
382+
install.
383+
384+
The commands below assume that you can compile a native python lib for the python version of your
385+
choice. See `this howto <http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/>`_
386+
how to install and setup such environments. If in doubt: use python 3.5 as it mostly works
387+
without fiddling with environment variables::
388+
389+
# create a new environment with the required packages
390+
conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado "cycler>=0.10" tk libpng zlib freetype
391+
activate matplotlib_build
392+
# if you want a qt backend, you also have to install pyqt (be aware that pyqt doesn't mix well if
393+
# you have created the environment with conda-forge already activated...)
394+
conda install pyqt
395+
# this package is only available in the conda-forge channel
396+
conda install -c conda-forge msinttypes
397+
# for python 2.7
398+
conda install -c conda-forge backports.functools_lru_cache
399+
400+
# copy the libs which have "wrong" names
401+
set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
402+
mkdir lib || cmd /c "exit /b 0"
403+
copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
404+
copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
405+
406+
# Make the header files and the rest of the static libs available during the build
407+
# CONDA_DEFAULT_ENV is a env variable which is set to the currently active environment path
408+
set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
409+
410+
# build the wheel
411+
python setup.py bdist_wheel
412+
413+
The `build_alllocal.cmd` script in the root folder automates these steps if
414+
you already created and activated the conda environment.
415+
416+
417+
Conda packages
418+
^^^^^^^^^^^^^^
419+
420+
This needs a `working installed C
421+
compiler
422+
<http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/>`_
423+
for the version of python you are compiling the package for but you don't need
424+
to setup the environment variables::
425+
426+
# only the first time...
427+
conda install conda-build
428+
429+
# the python version you want a package for...
430+
set CONDA_PY=3.5
431+
432+
# builds the package, using a clean build environment
433+
conda build ci\conda_recipe
434+
435+
# install the new package
436+
conda install --use-local matplotlib

README.osx

Lines changed: 0 additions & 31 deletions
This file was deleted.

README.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,25 @@
2020
.. _Depsy: http://depsy.org/package/python/matplotlib
2121

2222
##########
23-
matplotlib
23+
Matplotlib
2424
##########
2525

26-
matplotlib is a Python 2D plotting library which produces publication-quality
27-
figures in a variety of hardcopy formats and interactive
28-
environments across platforms. matplotlib can be used in Python
29-
scripts, the Python and IPython shell (ala MATLAB or Mathematica), web
30-
application servers, and various graphical user interface toolkits.
26+
Matplotlib is a Python 2D plotting library which produces publication-quality
27+
figures in a variety of hardcopy formats and interactive environments across
28+
platforms. Matplotlib can be used in Python scripts, the Python and IPython
29+
shell (ala MATLAB or Mathematica), web application servers, and various
30+
graphical user interface toolkits.
3131

3232
`Home page <http://matplotlib.org/>`_
3333

3434
Installation
3535
=============
3636

37-
For installation instructions and requirements, see the INSTALL file or the `install <http://matplotlib.org/users/installing.html>`_ documentation. If you think you may want to contribute to matplotlib, check out the `guide to working with the source code <http://matplotlib.org/devel/gitwash/index.html>`_.
37+
For installation instructions and requirements, see the INSTALL file or the
38+
`install <http://matplotlib.org/users/installing.html>`_ documentation. If you
39+
think you may want to contribute to matplotlib, check out the `guide to
40+
working with the source code
41+
<http://matplotlib.org/devel/gitwash/index.html>`_.
3842

3943
Testing
4044
=======

README.win.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)