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? 
I met the same problem before. But if matplotlib was imported first, it worked fine. I have no idea why.
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With