Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib says it needs libpng15, but I have libpng16

The problem is likely a configuration issue, because getting the installation correct on Macs seems to be tricky. I'm running Mavericks and matplotlib 1.4.x, yet when I open a Python 2.7.5 shell and import pylib, I get this error:

>>> import pylab

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pylab.py", line 230, in <module>
    import matplotlib.finance
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/finance.py", line 38, in <module>
    from matplotlib.collections import LineCollection, PolyCollection
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/backend_bases.py", line 55, in <module>
    import matplotlib.textpath as textpath
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/textpath.py", line 22, in <module>
    from matplotlib.mathtext import MathTextParser
  File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/mathtext.py", line 64, in <module>
    import matplotlib._png as _png
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/_png.so, 2): Library not loaded: /usr/local/lib/libpng15.15.dylib
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/_png.so
  Reason: image not found

I have libpng16 installed, but not libpng15.

like image 259
Rose Perrone Avatar asked Apr 16 '14 04:04

Rose Perrone


2 Answers

I saw a hardcoded reference to libpng15 in _png.so.
Uninstall and install of matplotlib fixed the issue for me.

like image 72
skf Avatar answered Oct 18 '22 22:10

skf


You can always moke it by generating a soft link like this

sudo ln -s /opt/X11/lib/libpng.dylib /usr/local/lib/libpng15.15.dylib

Not the cleaner solution but I haven't figure out why matplotlib stubbornly asks specifically for libpng15 and not any 15 or greater.

like image 27
Costas B. Avatar answered Oct 18 '22 23:10

Costas B.