On Wednesday, May 30, 2012, Amanda Stott wrote:

I am trying to build matplotlib from source on CentOS. I have installed all the dependencies, including numpy, freetype, libpng, etc. I also have both the C and C++ compiler (gcc and cgg-c++) installed in /usr/lib/. However when running python setup.py install I get the following error message:

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
running install
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-x86_64-2.4/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.linux-x86_64-2.4/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
c++ -pthread -shared build/temp.linux-x86_64-2.4/src/ft2font.o build/temp.linux-x86_64-2.4/src/mplutils.o build/temp.linux-x86_64-2.4/CXX/IndirectPythonInterface.o build/temp.linux-x86_64-2.4/CXX/cxxsupport.o build/temp.linux-x86_64-2.4/CXX/cxx_extensions.o build/temp.linux-x86_64-2.4/CXX/cxxextensions.o -L/usr/local/lib -L/usr/lib -L/usr/local/lib64 -L/usr/lib64 -lfreetype -lz -lstdc++ -lm -o build/lib.linux-x86_64-2.4/matplotlib/ft2font.so
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
error: command 'c++' failed with exit status 1

I have scoured the web with no solution. Please HELP!


Amanda Stott

The error indicates that it can't find libz, which is extremely odd because if you didnt have it, then most everything else would never work.  Which centos are you using?  How did you install your dependencies?
Ben Root