Monday, September 18, 2017

Matplotlib — libpng error: Incompatible libpng version in application and library

Leave a Comment

I installed matplotlib via

pip install matplotlib 

When I try to save png with it, I get

Application was compiled with png.h from libpng-1.6.21 libpng warning: Application  is  running with png.c from libpng-1.2.44 libpng error: Incompatible libpng version in application and library 

ldconfig -p | grep libpng gives me

libpng12.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libpng12.so.0 libpng12.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpng12.so.0 libpng12.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpng12.so 

I then build libpng1.6.21 from source and add its lib/ to my LD_LIBRARY_PATH. But ldconfig -p | grep libpng still gives me the samething as before. I tried rebuilding the ldconfig -- still only libpng12.

How can I let matplotlib pick up the newly installed libpng1.6.21?

Why is the new libpng1.6.21 in my LD_LIBRARY _PATH already, but not indexed by ldconfig?

2 Answers

Answers 1

I met the same problem before. But if matplotlib was imported first, it worked fine. I have no idea why.

Answers 2

A quick workaround would be to run your interpreter / script by specifying a custom value for LD_LIBRARY_PATH, e.g.:

LD_LIBRARY_PATH=/your/ld/path python 

or:

 export LD_LIBRARY_PATH=/your/ld/path  python 

For more permanent solutions, you may want to update the LD_LIBRARY_PATH in .profile or similar.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment