[Matplotlib-users] build matplotlib in anaconda environment, wrong png version

Gustavo Goretkin gustavo.goretkin at gmail.com
Fri Mar 4 09:41:40 EST 2016


I have a small script that saves a figure as png

sudo dtruss -t open python mintest_libpng.py 2> trace.txt

I see open syscalls to the following

open("/usr/local/opt/libpng/lib/libpng16.16.dylib\0", 0x0, 0x0)         = 4
0
open("/opt/X11/lib/libpng15.15.dylib\0", 0x0, 0x0)         = 4 0


I repeated that with the conda-installed version of matplotlib, and I don't
see any open syscalls that open libpng (?) Any ideas for building
matplotlib from source and installing in a conda environment?

On Thu, Mar 3, 2016 at 4:53 PM, Gustavo Goretkin <gustavo.goretkin at gmail.com
> wrote:

> I just tried to build v1.5.1 from source, with `python setup.py develop`,
> where `python` is a python within an anaconda distribution.
>
> It builds fine, and I can do many things with the library. But when
> saving, I see the warning
>
>
>
> libpng warning: Application built with libpng-1.6.17 but running with
>> 1.5.23
>>
>
> and eventually
>
> /Users/goretkin/repos/matplotlib/lib/matplotlib/backends/backend_pdf.py in
> _writePng(self, data)
>    1283
>    1284         buffer = BytesIO()
> -> 1285         _png.write_png(data, buffer)
>    1286         buffer.seek(8)
>    1287         written = 0
>
> RuntimeError: Could not create write struct
>
>
> Indeed, the build script shows
>
> BUILDING MATPLOTLIB
>             matplotlib: yes [1.5.1]
>                 python: yes [3.5.1 |Continuum Analytics, Inc.| (default,
> Dec
>                         7 2015, 11:24:55)  [GCC 4.2.1 (Apple Inc. build
>                         5577)]]
>               platform: yes [darwin]
>
> REQUIRED DEPENDENCIES AND EXTENSIONS
>                  numpy: yes [version 1.10.4]
>               dateutil: yes [using dateutil version 2.4.2]
>                   pytz: yes [using pytz version 2015.7]
>                 cycler: yes [using cycler version 0.10.0]
>                tornado: yes [using tornado version 4.3]
>              pyparsing: yes [using pyparsing version 2.0.3]
>                 libagg: yes [pkg-config information for 'libagg' could not
>                         be found. Using local copy.]
>               freetype: yes [version 2.5.5]
>                    png: yes [version 1.6.17]
>                  qhull: yes [pkg-config information for 'qhull' could not
> be
>                         found. Using local copy.]
>
> 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.
>
> goretkin-mbp:lib goretkin$ ls -la ~/anaconda2/envs/py3_601/lib/ | grep png
>> lrwxr-xr-x    1 goretkin  staff        10 Jan 23 14:14 libpng.a ->
>> libpng16.a
>> lrwxr-xr-x    1 goretkin  staff        17 Jan 23 14:14 libpng.dylib ->
>> libpng16.16.dylib
>> lrwxr-xr-x    1 goretkin  staff        11 Jan 23 14:14 libpng.la ->
>> libpng16.la
>> -rwxr-xr-x    7 goretkin  staff    271336 May 26  2015 libpng16.16.dylib
>> -rw-r--r--    7 goretkin  staff    360224 May 26  2015 libpng16.a
>> lrwxr-xr-x    1 goretkin  staff        17 Jan 23 14:14 libpng16.dylib ->
>> libpng16.16.dylib
>> -rwxr-xr-x    1 goretkin  staff       951 Jan 23 14:14 libpng16.la
>>
>
>
> $ otool -L ~/anaconda2/envs/py3_601/lib/libpng.dylib
> /Users/goretkin/anaconda2/envs/py3_601/lib/libpng.dylib:
>     libpng16.16.dylib (compatibility version 34.0.0, current version
> 34.0.0)
>     /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version
> 1.2.3)
>     /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
> version 1.0.0)
>     /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 111.0.0)
>
>
>
> Thanks,
> Gustavo
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160304/4eb08228/attachment-0001.html>


More information about the Matplotlib-users mailing list