简体   繁体   中英

Install Matplotlib: Command "python setup.py egg_info" failed with error code 1 (proposed solutions did not work)

I am aware, that this question was asked a couple of times, but none of the proposed solutions worked for me. I want to install the matplotlib package with pip install matplotlib==1.5.1 (this version was recommended by https://stackoverflow.com/a/38126910/3554329 ). However, I get the following message:

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 [2.7.5 (default, Jul 13 2018, 13:06:57)  [GCC
                        4.8.5 20150623 (Red Hat 4.8.5-28)]]
              platform: yes [linux2]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.15.1]
              dateutil: yes [using dateutil version 2.7.3]
                  pytz: yes [using pytz version 2016.10]
                cycler: yes [using cycler version 0.10.0]
               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 [Your pyparsing contains a bug that will be
                        monkey-patched by matplotlib.  For best results,
                        upgrade to pyparsing 2.0.1 or later.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: yes [version 2.4.11]
                   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 [using nose version 1.3.7 / 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 [using nose version 1.3.7 / 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: yes [installing, Qt: 4.8.5, PyQt: 4.8.5; PySide not
                        found]

** (-c:230059): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-7WVKLv55ER: Connection refused
               gtk3agg: yes [installing, version 3.26.22]

** (-c:230064): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-7WVKLv55ER: Connection refused
             gtk3cairo: yes [installing, version 3.26.22]
                gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                 tkagg: no  [TKAgg requires Tkinter.]
                 wxagg: no  [requires wxPython]
                   gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                   agg: yes [installing]
                 cairo: yes [installing, pycairo version 1.8.10]
             windowing: no  [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
                dvipng: yes [version 1.14]
           ghostscript: yes [version 9.07]
                 latex: no
               pdftops: no

OPTIONAL PACKAGE DATA
                  dlls: no  [skipping due to configuration]

============================================================================
                        * The following required packages can not be built:
                        * png

----------------------------------------

With the following error:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-fm442m/matplotlib/

As porposed, I upgraded my setuptools:

[root@------- ~]# pip install --upgrade setuptools
Requirement already up-to-date: setuptools in /usr/lib/python2.7/site-packages (40.4.3)

I also tried to use easy_install , but it did not work either. Does anybody have an idea, how to solve this?

For any lost souls potentially still struggling with this problem, I also was unable to solve this by simply doing pip install --upgrade setuptools .

I was able to get this working, however, in Python3, which I suppose only partially answers your original question -- but hopefully can be helpful nonetheless.

Computer: MacBook Pro (Retina, 13-inch, Mid 2014) OS: 10.11.6 (El Capitan) Python: 3.5.1

pip3 install --upgrade setuptools
pip3 install matplotlib==1.5.3

Note: unclear if the upgrade setuptools did anything, but including here anyway since I did it and now things are working. Note: 1.5.3 is a different version than you were using FYI

I have had same problem. I resolve it:

pip install --upgrade setuptools
sudo apt install libpng-dev libfreetype6-dev
pip install matplotlib==1.4.3

对于 Windows,以管理员身份打开命令提示符,然后键入:

pip install matplotlib

I had this issue and I have just figured it out, try installing the dependencies manually first

cycler>=0.10       
kiwisolver>=1.0.1  
python-dateutil>=2.7 
numpy>=1.16        
pillow>=6.2.0       
pyparsing>=2.2.1   
six 

For me it was on an armv7 architecture and I was installing from requirements.txt and it would hang on the installation of matplotlib but when I commented out matplotlib and installed everything else from the requirements.txt including the above listed libs it doesn't hang anymore.

Got a similar issue on macOS Big Sur (11.4). These commands worked for me

pip install --upgrade pip
pip install --upgrade matplotlib

Not sure how it resolved the issue but somehow it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM