conda-forge / vtk-feedstock

A conda-smithy repository for vtk.
BSD 3-Clause "New" or "Revised" License
13 stars 64 forks source link

libpng warning: Application built with libpng-1.4.12 but running with 1.6.37 #109

Closed aeslaughter closed 4 years ago

aeslaughter commented 4 years ago

Issue:

$ ./cube.py
libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
ERROR: In ../IO/Image/vtkPNGWriter.cxx, line 232
vtkPNGWriter (0x7fa383c7a180): Unable to write PNG file!


cube.py

#!/usr/bin/env python3 import vtk source = vtk.vtkCubeSource() mapper = vtk.vtkPolyDataMapper() mapper.SetInputConnection(source.GetOutputPort()) actor = vtk.vtkActor() actor.SetMapper(mapper) renderer = vtk.vtkRenderer() renderer.AddActor(actor) window = vtk.vtkRenderWindow() window.AddRenderer(renderer) window.SetSize(500, 500) window.Render() window_filter = vtk.vtkWindowToImageFilter() window_filter.SetInput(window) window_filter.Update() writer = vtk.vtkPNGWriter() writer.SetFileName('cube.png') writer.SetInputData(window_filter.GetOutput()) writer.Write()


Environment (conda list):

``` $ conda list # packages in environment at /Users/slauae/opt/miniconda3/envs/vtk: # # Name Version Build Channel bzip2 1.0.8 h0b31af3_2 conda-forge ca-certificates 2019.11.28 hecc5488_0 conda-forge certifi 2019.11.28 py38h32f6830_1 conda-forge curl 7.68.0 h8754def_0 conda-forge expat 2.2.9 h4a8c4bd_2 conda-forge freetype 2.10.1 h8da9a1a_0 conda-forge future 0.18.2 py38h32f6830_1 conda-forge hdf4 4.2.13 h84186c3_1003 conda-forge hdf5 1.10.5 nompi_h3e39495_1104 conda-forge icu 64.2 h6de7cb9_1 conda-forge jpeg 9c h1de35cc_1001 conda-forge jsoncpp 1.8.4 ha1b3eb9_1002 conda-forge krb5 1.16.4 h1752a42_0 conda-forge libcurl 7.68.0 h709d2b2_0 conda-forge libcxx 9.0.1 1 conda-forge libedit 3.1.20170329 hcfe32e1_1001 conda-forge libffi 3.2.1 h4a8c4bd_1007 conda-forge libgfortran 4.0.0 2 conda-forge libiconv 1.15 h0b31af3_1006 conda-forge libnetcdf 4.7.3 nompi_hda4e5f1_101 conda-forge libpng 1.6.37 hbbe82c9_1 conda-forge libssh2 1.8.2 hcdc9a53_2 conda-forge libtiff 4.1.0 h2ae36a8_6 conda-forge libwebp-base 1.1.0 h0b31af3_3 conda-forge libxml2 2.9.10 h53d96d6_0 conda-forge llvm-openmp 9.0.1 h28b9765_2 conda-forge lz4-c 1.8.3 h6de7cb9_1001 conda-forge ncurses 6.1 h0a44026_1002 conda-forge openssl 1.1.1e h0b31af3_0 conda-forge pip 20.0.2 py_2 conda-forge python 3.8.2 hd5f0129_5_cpython conda-forge python_abi 3.8 1_cp38 conda-forge readline 8.0 hcfe32e1_0 conda-forge setuptools 46.1.1 py38h32f6830_0 conda-forge sqlite 3.30.1 h93121df_0 conda-forge tbb 2019.9 ha1b3eb9_1 conda-forge tk 8.6.10 hbbe82c9_0 conda-forge vtk 8.2.0 py38h1d7f82d_210 conda-forge wheel 0.34.2 py_1 conda-forge xz 5.2.4 h0b31af3_1002 conda-forge zlib 1.2.11 h0b31af3_1006 conda-forge zstd 1.4.4 hed8d7c8_2 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : vtk active env location : /Users/slauae/opt/miniconda3/envs/vtk shell level : 3 user config file : /Users/slauae/.condarc populated config files : /Users/slauae/projects/slaughter/config/condarc conda version : 4.8.3 conda-build version : not installed python version : 3.7.4.final.0 virtual packages : __osx=10.15.3 base environment : /Users/slauae/opt/miniconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /Users/slauae/opt/miniconda3/pkgs /Users/slauae/.conda/pkgs envs directories : /Users/slauae/opt/miniconda3/envs /Users/slauae/.conda/envs platform : osx-64 user-agent : conda/4.8.3 requests/2.23.0 CPython/3.7.4 Darwin/19.3.0 OSX/10.15.3 UID:GID : 501:20 netrc file : None offline mode : False ```
aeslaughter commented 4 years ago

It works with vtk=8.1.2 python=3.7

$ conda list
# packages in environment at /Users/slauae/opt/miniconda3/envs/vtk:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h0b31af3_2    conda-forge
ca-certificates           2019.11.28           hecc5488_0    conda-forge
certifi                   2019.11.28       py37hc8dfbb8_1    conda-forge
curl                      7.68.0               h8754def_0    conda-forge
expat                     2.2.9                h4a8c4bd_2    conda-forge
freetype                  2.10.1               h8da9a1a_0    conda-forge
future                    0.18.2           py37hc8dfbb8_1    conda-forge
hdf4                      4.2.13            h84186c3_1003    conda-forge
hdf5                      1.10.4          nompi_h0cbb7df_1106    conda-forge
icu                       64.2                 h6de7cb9_1    conda-forge
jpeg                      9c                h1de35cc_1001    conda-forge
jsoncpp                   1.8.4             ha1b3eb9_1002    conda-forge
krb5                      1.16.4               h1752a42_0    conda-forge
libcurl                   7.68.0               h709d2b2_0    conda-forge
libcxx                    9.0.1                         1    conda-forge
libedit                   3.1.20170329      hcfe32e1_1001    conda-forge
libffi                    3.2.1             h4a8c4bd_1007    conda-forge
libgfortran               3.0.1                         0    conda-forge
libiconv                  1.15              h0b31af3_1006    conda-forge
libnetcdf                 4.6.2             h6b88ef6_1001    conda-forge
libogg                    1.3.2             h0b31af3_1002    conda-forge
libpng                    1.6.37               hbbe82c9_1    conda-forge
libssh2                   1.8.2                hcdc9a53_2    conda-forge
libtheora                 1.1.1             h0b31af3_1003    conda-forge
libtiff                   4.0.10            h344961e_1002    conda-forge
libvorbis                 1.3.6                h4a8c4bd_2    conda-forge
libxml2                   2.9.10               h53d96d6_0    conda-forge
lz4-c                     1.8.1.2                       0    conda-forge
ncurses                   6.1               h0a44026_1002    conda-forge
openssl                   1.1.1e               h0b31af3_0    conda-forge
pip                       20.0.2                     py_2    conda-forge
python                    3.7.6           h90870a6_5_cpython    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
readline                  8.0                  hcfe32e1_0    conda-forge
setuptools                46.1.1           py37hc8dfbb8_0    conda-forge
sqlite                    3.30.1               h93121df_0    conda-forge
tbb                       2019.9               ha1b3eb9_1    conda-forge
tk                        8.6.10               hbbe82c9_0    conda-forge
vtk                       8.1.2           py37h238a7ee_1200    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xz                        5.2.4             h0b31af3_1002    conda-forge
zlib                      1.2.11            h0b31af3_1006    conda-forge
zstd                      1.3.3                         1    conda-forge
xylar commented 4 years ago

@aeslaughter, I'm sorry this is happening. I ran the same tests in linux and don't see the problem there.

I looked at the CI for build 210 and there's something strange going on. The right libpng is being installed:

The following NEW packages will be INSTALLED:

...
    libpng:          1.6.37-hbbe82c9_1          conda-forge
...

but later on when libpng is detected, I see:

-- Found PNG: $PREFIX/lib/libpng.dylib (found version "1.4.12") 

This seems to be true for all OSX builds but not for linux builds. It also seems to be true for builds 8 and 9 (perhaps earlier builds, but I didn't look back further).

The most likely explanation would seem to be that the version of libpng shipped with VTK is getting used instead of the conda-forge version, despite the cmake flag -DVTK_USE_SYSTEM_PNG:BOOL=ON. This is kind of baffling but I'll see if I can figure anything out.

xylar commented 4 years ago

I'm afraid this is beyond my limited knowledge of either cmake or OSX. Similar problems would appear to be occurring with libjpeg and libtiff:

    jpeg:            9c-h1de35cc_1001           conda-forge
...
    libpng:          1.6.37-hbbe82c9_1          conda-forge
...
    libtiff:         4.1.0-h2ae36a8_5           conda-forge
...
-- Found JPEG: $PREFIX/lib/libjpeg.dylib (found version "80") 
-- Found PNG: $PREFIX/lib/libpng.dylib (found version "1.4.12") 
-- Found TIFF: $PREFIX/lib/libtiff.dylib (found version "4.0.8") 

Hopefully someone else from @conda-forge/vtk can help us fix this?

aeslaughter commented 4 years ago

@xylar You are correct, it works fine for linux. Also, I have been messing around with different environments and the problem might be related to python 3.8 only.

As mentioned above, it worked with vtk=8.1.2 and python=3.7. In this same environment I updated using conda install vtk=8.2 and it still works.

Finally, TIFF works just fine with vtk=8.2 python=3.8, perhaps those libraries are more compatible across version so it doesn't matter.

xylar commented 4 years ago

@aeslaughter, I think I was testing with other python versions and still saw the problem you mention, but here was a lot to test so I don't remember for certain. But older builds wouldn't have had python 3.8, so I'm almost completely sure I wasn't using it for all my testing.

TIFF works just fine with vtk=8.2 python=3.8, perhaps those libraries are more compatible across version so it doesn't matter.

Okay, that's one positive, at least.

Over all, I would say this should hopefully be fixed with the release of 9.0.0. We're working on building the release candidate correctly on the vtk_dev label. Not sure when the release well happen, but something to watch for.

aeslaughter commented 4 years ago

Is it possible to get build logs from conda, as suggested here? https://gitlab.kitware.com/vtk/vtk/-/issues/17817#note_721435

xylar commented 4 years ago

Yes, here are the build logs from the latest commit to master: https://github.com/conda-forge/vtk-feedstock/runs/520545836

You can find build logs for any commit by looking through the commits and going to either the green check mark or the red x.

aeslaughter commented 4 years ago

The libpng error is still a problem for build 211, even with #114.

$ ./cube.py
libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
ERROR: In ../IO/Image/vtkPNGWriter.cxx, line 232
vtkPNGWriter (0x7fc105e43dc0): Unable to write PNG file!

$ conda list
# packages in environment at /Users/slauae/opt/miniconda3/envs/vtk:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h0b31af3_2    conda-forge
ca-certificates           2019.11.28           hecc5488_0    conda-forge
certifi                   2019.11.28       py38h32f6830_1    conda-forge
curl                      7.68.0               h8754def_0    conda-forge
expat                     2.2.9                h4a8c4bd_2    conda-forge
freetype                  2.10.1               h8da9a1a_0    conda-forge
future                    0.18.2           py38h32f6830_1    conda-forge
hdf4                      4.2.13            h84186c3_1003    conda-forge
hdf5                      1.10.5          nompi_h3e39495_1104    conda-forge
icu                       64.2                 h6de7cb9_1    conda-forge
jpeg                      9c                h1de35cc_1001    conda-forge
jsoncpp                   1.8.4             ha1b3eb9_1002    conda-forge
krb5                      1.16.4               h1752a42_0    conda-forge
libcurl                   7.68.0               h709d2b2_0    conda-forge
libcxx                    9.0.1                         1    conda-forge
libedit                   3.1.20170329      hcfe32e1_1001    conda-forge
libffi                    3.2.1             h4a8c4bd_1007    conda-forge
libgfortran               4.0.0                         2    conda-forge
libiconv                  1.15              h0b31af3_1006    conda-forge
libnetcdf                 4.7.3           nompi_hda4e5f1_101    conda-forge
libpng                    1.6.37               hbbe82c9_1    conda-forge
libssh2                   1.8.2                hcdc9a53_2    conda-forge
libtiff                   4.1.0                h2ae36a8_6    conda-forge
libwebp-base              1.1.0                h0b31af3_3    conda-forge
libxml2                   2.9.10               h53d96d6_0    conda-forge
llvm-openmp               9.0.1                h28b9765_2    conda-forge
lz4-c                     1.8.3             h6de7cb9_1001    conda-forge
ncurses                   6.1               h0a44026_1002    conda-forge
openssl                   1.1.1e               h0b31af3_0    conda-forge
pip                       20.0.2                     py_2    conda-forge
python                    3.8.2           hd5f0129_5_cpython    conda-forge
python_abi                3.8                      1_cp38    conda-forge
readline                  8.0                  hcfe32e1_0    conda-forge
setuptools                46.1.3           py38h32f6830_0    conda-forge
sqlite                    3.30.1               h93121df_0    conda-forge
tbb                       2019.9               ha1b3eb9_1    conda-forge
tk                        8.6.10               hbbe82c9_0    conda-forge
vtk                       8.2.0           py38h1d7f82d_211    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xz                        5.2.4             h0b31af3_1002    conda-forge
zlib                      1.2.11            h0b31af3_1006    conda-forge
zstd                      1.4.4                hed8d7c8_2    conda-forge