21

Using Python 2.7 on Windows 7. Here is the command I am using to install and error message. Wondering if anyone have met with similar issues before? Thanks.

C:\Python27\Scripts>pip install matplotlib
Collecting matplotlib
  Downloading matplotlib-1.5.2.tar.gz (51.6MB)
    100% |################################| 51.6MB 19kB/s
    Complete output from command python setup.py egg_info:
    ============================================================================

    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.2]
                    python: yes [2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015,
                            20:40:30) [MSC v.1500 64 bit (AMD64)]]
                  platform: yes [win32]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.11.1]
                  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 freetype (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: no  [The C/C++ header for png (png.h) could not be
                            found.  You may need to install the development
                            package.]
                     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 / mock is
                            required to run the matplotlib test suite. Please
                            install it with pip or your preferred tool to run
                            the test suite]
            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 / mock is
                            required to run the matplotlib test suite. Please
                            install it with pip or your preferred tool to run
                            the test suite]

    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: yes [installing; run-time loading from Python Tcl /
                            Tk]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: yes [installing]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

    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 c:\users\foo\a
ppdata\local\temp\pip-build-zxfsow\matplotlib\
Lin Ma
  • 9,739
  • 32
  • 105
  • 175

8 Answers8

14

As you can see it png and freetype modules are missing. You need to install them separately.

Try doing the following :

> pip install freetype-py
> pip install pypng
> pip install matplotlib
Ryan B.
  • 1,270
  • 10
  • 24
  • 1
    Vote up thanks Ryan, but your method still have issues. I tried the unofficial package from be_good_do_good, and works pretty good. :) – Lin Ma Aug 21 '16 at 05:15
  • Although I can install frretype-py and pypng, unfortunately matplotlib seems to require exactly png and exactly freetype package name – Antonio May 11 '17 at 09:41
  • 2
    You also need to install the `libpng-devel` and `libfreetype-devel` packages for the `matplotlib` installer to succeed - it isn't a problem with the package name (it took me a good hour to figure this out). – zelanix Dec 12 '17 at 16:36
  • @zelanix pip can't find anything called libpng-devel or libfreetype-devel ? – Niels Oct 08 '19 at 13:26
  • 1
    @Niels - no, that's right - they are OS packages. Install them using `apt` or the equivalent for your system (although note that the exact package name might be different - I think I was using Cygwin at the time). – zelanix Oct 09 '19 at 23:11
  • 2
    So what is the equivalent for Windows systems? – MERose Nov 19 '19 at 14:43
12

I solved it by taking version 1.5.1

pip install matplotlib==1.5.1

it seems that version 1.5.2 installer is broken.

7

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Get matplotlib from above location. Choose correct package based on python(2.x/3.x) and bit(32/64) version.

32-bit 2.7: matplotlib-1.5.2-cp27-cp27m-win32.whl
64-bit 2.7: matplotlib-1.5.2-cp27-cp27m-win_amd64.whl

If you face any issues in the middle, please refer to below link: https://stackoverflow.com/a/38618044/5334188

Community
  • 1
  • 1
be_good_do_good
  • 4,311
  • 3
  • 28
  • 42
4

I had the exact same issue.

Seems that my pip was v7 which is old. upgraded to v9 with the 'upgrade' button. then tried to install matplotlib again and was successful this time.

maybe this helps

E.Mich
  • 129
  • 8
2

I came across the same problem with you, and here is my solution

It has the problem with python 3.6 integrated with the newest pip. so I installed python 3.5.2 with pip, but do not upgrade pip. And you can get matplotlib installed in this way.

Hope I could provide a possible solution

Mark
  • 21
  • 1
1

I solved the same problem in Wİndows 10 as folowing:

1- Download the following files for win32 or win64 python3.7:

matplotlib-2.2.2-cp27-cp37m-win32.whl

or

matplotlib-2.2.2-cp27-cp37m-win_amd64.whl

from the https://www.lfd.uci.edu/~gohlke/pythonlibs/

2- By cmd console run the downloaded file under python:

.\Downloads> python -m pip install matplotlib-2.2.2-cp37-cp37m-win_amd64.whl

you can try the matplolib

1

I had this problem today with Python 3.8.0 and the installation was successfully with matplotlib==3.2.0rc1 after I installed freetype-py.

Matt Cremeens
  • 4,951
  • 7
  • 38
  • 67
  • Thanks! The only thing that worked for me on a computer within a company network on Windows 10 and Python 3.8 through command prompt in a virtual environment. – PM0087 Nov 18 '19 at 17:00
1

Installing the specific matplotlib version 2.2.5 worked for me on Windows 10.

The commmand to install a specific version via pip:

pip install matplotlib==2.2.5
Cribber
  • 2,513
  • 2
  • 21
  • 60
Bobby. A.
  • 11
  • 1