user1775563
user1775563

Reputation: 317

Issue importing matplotlib.pyplot

I am pretty new to Python, having just taken a course and now trying to apply what I learned to convert matlab code to python. I have to plot some things, so I tried to import matplotlib.pyplot but keep getting

Incompatible library version: _png.so requires version 42.0.0 or later, but libpng12.0.dylib provides version 41.0.0

I don't really understand how to either update my libpng12.0.dylib (since I am not really a programmer, just someone who wants to learn python, so please be easy on me if this is a super easy question!), or tell my _png.so to look somewhere else, if that is appropriate. I have done a lot of digging in to this, and I know that there are a number of issues with installing matplotlib on osX, but I haven't seen anything about how to resolve this one.

I am running Enthought Canopy, using python 2.7, and I am running OS X 10.8

I really appreciate any help

Upvotes: 2

Views: 305

Answers (1)

Phil V
Phil V

Reputation: 11

Check your DYLD_LIBRARY_PATH and LD_LIBRARY_PATH. Make sure that you have your library paths in the right order. I changed mine recently due to a matlab install and it took ages before I made the connection that it was my LD_LIBRARY_PATH that was stuffed. Programs go searching for the libraries in the order specified by those paths. If you have another libpng (as I did) in a library path before the canopy one, then it will use that. Fine if the version is recent, otherwise you get these errors.

First unset them both and then run python and your plot. Hopefully that works. Then go about fixing your DYLD_LIBRARY_PATH and LD_LIBRARY_PATH.

I put these at the front of both /opt/local/lib:/Users/xxxxx/Library/Enthought/Canopy_64bit/User/lib

My error was ...

/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/_png.so Reason: Incompatible library version: _png.so requires version 41.0.0 or later, but libpng12.dylib provides version 40.0.0

Upvotes: 1

Related Questions