0

I'm looking to install matplotlib on CentOS using :

yum install python-matplotlib.x86_64

It works but the problem is that it is an old version (matplotlib 0.99.1.1) and I need the last version : [1.3.1].

So I've downloaded the source and trying with : python setup.py install But I get this error ...


Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.3.1]
                python: yes [2.6.6 (r266:84292, Jan 22 2014, 09:42:36)  [GCC
                        4.4.7 20120313 (Red Hat 4.4.7-4)]]
              platform: yes [linux2]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.8.1]
              dateutil: yes [using dateutil version 1.4.1]
               tornado: yes [using tornado version 3.2.2]
             pyparsing: yes [using pyparsing version 2.0.2]
                 pycxx: yes [Couldn't import.  Using local copy.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: yes [version 9.22.3]
                   png: yes [version 1.2.49]

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]

OPTIONAL BACKEND EXTENSIONS
                macosx: no  [Mac OS-X only]
                qt4agg: no  [PyQt4 not found]
               gtk3agg: no  [Requires pygobject to be installed.]
             gtk3cairo: no  [Requires pygobject to be installed.]
Xlib:  extension "RANDR" missing on display "localhost:22.0".
                gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                 tkagg: yes [installing, version 73770]
                 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, version 1.8.6]
             windowing: no  [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
                dvipng: yes [version 1.11]
           ghostscript: yes [version 8.70]
                 latex: yes [version 3.141592]
               pdftops: no

running install
running bdist_egg
running egg_info
writing requirements to lib/matplotlib.egg-info/requires.txt
writing lib/matplotlib.egg-info/PKG-INFO
writing namespace_packages to lib/matplotlib.egg-info/namespace_packages.txt
writing top-level names to lib/matplotlib.egg-info/top_level.txt
writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt
reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-x86_64-2.6/matplotlib/mpl-data
running build_ext
building 'matplotlib._png' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib__png_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/lib64/python2.6/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/include/libpng12 -I/usr/include/python2.6 -c src/_png.cpp -o build/temp.linux-x86_64-2.6/src/_png.o
In file included from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1798,
                 from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from src/_png.cpp:28:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
src/_png.cpp:243:48: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given
src/_png.cpp:264:44: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given
src/_png.cpp:577:44: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given
In file included from src/file_compat.h:4,
                 from src/_png.cpp:31:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ‘PyObject* npy_PyFile_OpenFile(PyObject*, const char*)’:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h:348: warning: deprecated conversion from string constant to ‘char*’
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ‘int npy_PyFile_CloseFile(PyObject*)’:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h:356: warning: deprecated conversion from string constant to ‘char*’
src/_png.cpp: In member function ‘Py::Object _png_module::write_png(const Py::Tuple&)’:
src/_png.cpp:243: error: ‘npy_PyFile_DupClose’ was not declared in this scope
src/_png.cpp:264: error: ‘npy_PyFile_DupClose’ was not declared in this scope
src/_png.cpp: In member function ‘PyObject* _png_module::_read_png(const Py::Object&, bool, int)’:
src/_png.cpp:329: warning: deprecated conversion from string constant to ‘char*’
src/_png.cpp:577: error: ‘npy_PyFile_DupClose’ was not declared in this scope
error: command 'gcc' failed with exit status 1

Any helps ? Thanks

Picasa
  • 59
  • 1
  • 6
  • Its expecting a certain function to be provided by Numpy which isnt provided. Check if the installed version of Numpy matches the required version for matplotlib. Also check if you have the developer files for numpy since the setup is likely linking against those. – EWit Jul 09 '14 at 09:04

1 Answers1

0

This has been fixed in version 1.4.0 (see patch here). I have successfully compiled version 1.4.0 on CentOS 6.5 after patching setupext.py to lower the required freetype version (as suggested in the installation notes).

  • As rekado says, this turns out to be relatively simple on CentOS-6.5, using the default python-2.6. Full procedure using pip and virtualenv is here: http://stackoverflow.com/q/25634689/1446918 – Micromégas Sep 15 '14 at 12:48