<div dir="ltr"><div>I just tried to build v1.5.1 from source, with `python setup.py develop`, where `python` is a python within an anaconda distribution.<br><br></div><div>It builds fine, and I can do many things with the library. But when saving, I see the warning<br><br><br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">libpng warning: Application built with libpng-1.6.17 but running with 1.5.23<br></blockquote><br></div><div>and eventually<br><br><blockquote>/Users/goretkin/repos/matplotlib/lib/matplotlib/backends/backend_pdf.py in _writePng(self, data)<br>   1283 <br>   1284         buffer = BytesIO()<br>-> 1285         _png.write_png(data, buffer)<br>   1286         buffer.seek(8)<br>   1287         written = 0<br><br>RuntimeError: Could not create write struct<br></blockquote><br></div><div>Indeed, the build script shows<br></div><div><br>BUILDING MATPLOTLIB<br>            matplotlib: yes [1.5.1]<br>                python: yes [3.5.1 |Continuum Analytics, Inc.| (default, Dec<br>                        7 2015, 11:24:55)  [GCC 4.2.1 (Apple Inc. build<br>                        5577)]]<br>              platform: yes [darwin]<br><br>REQUIRED DEPENDENCIES AND EXTENSIONS<br>                 numpy: yes [version 1.10.4]<br>              dateutil: yes [using dateutil version 2.4.2]<br>                  pytz: yes [using pytz version 2015.7]<br>                cycler: yes [using cycler version 0.10.0]<br>               tornado: yes [using tornado version 4.3]<br>             pyparsing: yes [using pyparsing version 2.0.3]<br>                libagg: yes [pkg-config information for 'libagg' could not<br>                        be found. Using local copy.]<br>              freetype: yes [version 2.5.5]<br>                   png: yes [version 1.6.17]<br>                 qhull: yes [pkg-config information for 'qhull' could not be<br>                        found. Using local copy.]<br><br></div><div>Is this a problem with anaconda reporting the wrong paths? Indeed the version of libpng in this anaconda environment is libpng16, so its right to build against it. At run time, someone's to blame for loading the wrong dynamic library.<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">goretkin-mbp:lib goretkin$ ls -la ~/anaconda2/envs/py3_601/lib/ | grep png<br>lrwxr-xr-x    1 goretkin  staff        10 Jan 23 14:14 libpng.a -> libpng16.a<br>lrwxr-xr-x    1 goretkin  staff        17 Jan 23 14:14 libpng.dylib -> libpng16.16.dylib<br>lrwxr-xr-x    1 goretkin  staff        11 Jan 23 14:14 <a href="http://libpng.la">libpng.la</a> -> <a href="http://libpng16.la">libpng16.la</a><br>-rwxr-xr-x    7 goretkin  staff    271336 May 26  2015 libpng16.16.dylib<br>-rw-r--r--    7 goretkin  staff    360224 May 26  2015 libpng16.a<br>lrwxr-xr-x    1 goretkin  staff        17 Jan 23 14:14 libpng16.dylib -> libpng16.16.dylib<br>-rwxr-xr-x    1 goretkin  staff       951 Jan 23 14:14 <a href="http://libpng16.la">libpng16.la</a><br></blockquote><br><br>$ otool -L ~/anaconda2/envs/py3_601/lib/libpng.dylib<br>/Users/goretkin/anaconda2/envs/py3_601/lib/libpng.dylib:<br>    libpng16.16.dylib (compatibility version 34.0.0, current version 34.0.0)<br>    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)<br>    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)<br>    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)<br><br></div><div><br><br></div><div>Thanks,<br></div><div>Gustavo<br></div><div><br><br></div></div>