Install matplotlib on CentOS7

Source: Internet
Author: User

Install matplotlib on CentOS7
PROBLEM

Install matplotlib in CentOS 7.

pip install matplotlib

The following error is reported:

[root@localhost Desktop]# pip install matplotlibCollecting matplotlib  Using cached matplotlib-1.5.1.tar.gz    Complete output from command python setup.py egg_info:    ============================================================================    Edit setup.cfg to change the build options    BUILDING MATPLOTLIB                matplotlib: yes [1.5.1]                    python: yes [3.5.1 (default, Apr 15 2016, 00:15:43)  [GCC                            4.8.5 20150623 (Red Hat 4.8.5-4)]]                  platform: yes [linux]    REQUIRED DEPENDENCIES AND EXTENSIONS                     numpy: yes [version 1.11.0]                  dateutil: yes [dateutil was not found. It is required for date                            axis support. pip/easy_install may attempt to                            install it after matplotlib.]                      pytz: yes [pytz was not found. pip will attempt to install                            it after matplotlib.]                    cycler: yes [cycler was not found. pip will attempt to                            install it after matplotlib.]                   tornado: yes [tornado was not found. It is required for the                            WebAgg backend. pip/easy_install may attempt to                            install it after matplotlib.]                 pyparsing: yes [pyparsing was not found. It is required for                            mathtext support. pip/easy_install may attempt to                            install it after matplotlib.]                    libagg: yes [pkg-config information for 'libagg' could not                            be found. Using local copy.]                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)                            could not be found.  You may need to install the                            development package.]                       png: no  [pkg-config information for 'libpng' could not                            be found.]                     qhull: yes [pkg-config information for 'qhull' could not be                            found. Using local copy.]    OPTIONAL SUBPACKAGES               sample_data: yes [installing]                  toolkits: yes [installing]                     tests: yes [nose 0.11.1 or later is required to run the                            matplotlib test suite. Please install it with pip or                            your preferred tool to run the test suite / using                            unittest.mock]            toolkits_tests: yes [nose 0.11.1 or later is required to run the                            matplotlib test suite. Please install it with pip or                            your preferred tool to run the test suite / using                            unittest.mock]    OPTIONAL BACKEND EXTENSIONS                    macosx: no  [Mac OS-X only]                    qt5agg: no  [PyQt5 not found]                    qt4agg: no  [PySide not found; PyQt4 not found]                   gtk3agg: no  [Requires pygobject to be installed.]                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]                    gtkagg: no  [Requires pygtk]                     tkagg: no  [TKAgg requires Tkinter.]                     wxagg: no  [requires wxPython]                       gtk: no  [Requires pygtk]                       agg: yes [installing]                     cairo: no  [cairocffi or pycairo not found]                 windowing: no  [Microsoft Windows only]    OPTIONAL LATEX DEPENDENCIES                    dvipng: no               ghostscript: yes [version 9.07]                     latex: no                   pdftops: yes [version 0.26.5]    OPTIONAL PACKAGE DATA                      dlls: no  [skipping due to configuration]    ============================================================================                            * The following required packages can not be built:                            * freetype, png    ----------------------------------------Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hlld4ja8/matplotlib/

It indicates that some dependent packages are missing. Some Dependent packages are related to python, and pip will be installed automatically. For example, this sentence means:

pip/easy_install may attempt to install it after matplotlib.
REASON

Some Dependent packages cannot be solved by pip, and yum is required for update and installation. For example:

freetype: no  [The C/C++ header for freetype2 (ft2build.h) could not be found. You may need to install the development package.]
SOLUTION

Finally, two dependency packages are installed to solve the problem.

sudo yum install freetype-develsudo yum install libpng-develsudo pip install matplotlib
RESULT
[root@localhost perrin]# pip install matplotlibCollecting matplotlib  Using cached matplotlib-1.5.1.tar.gzRequirement already satisfied (use --upgrade to upgrade): numpy>=1.6 in /usr/local/lib/python3.5/site-packages (from matplotlib)Collecting python-dateutil (from matplotlib)  Downloading python_dateutil-2.5.2-py2.py3-none-any.whl (201kB)    100% |████████████████████████████████| 204kB 23kB/s Collecting pytz (from matplotlib)  Downloading pytz-2016.3-py2.py3-none-any.whl (479kB)    100% |████████████████████████████████| 481kB 43kB/s Collecting cycler (from matplotlib)  Downloading cycler-0.10.0-py2.py3-none-any.whlCollecting pyparsing!=2.0.0,!=2.0.4,>=1.5.6 (from matplotlib)  Downloading pyparsing-2.1.1-py2.py3-none-any.whlCollecting six>=1.5 (from python-dateutil->matplotlib)  Downloading six-1.10.0-py2.py3-none-any.whlInstalling collected packages: six, python-dateutil, pytz, cycler, pyparsing, matplotlib  Running setup.py install for matplotlib ... doneSuccessfully installed cycler-0.10.0 matplotlib-1.5.1 pyparsing-2.1.1 python-dateutil-2.5.2 pytz-2016.3 six-1.10.0[root@localhost perrin]# 

When matplotlib is installed, some dependent python-related packages, such as javaser-0.10.0, pyparsing-2.1.1, python-dateutil-2.5.2, pytz-2016.3, six-1.10.0, are automatically installed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.