Problem with using Images.


#1

Hi All

I’m doing my first step in the julia programming.
I love the concept of the language but all my baby steps are so hard that I’m close to give up.
For example, very simple test I picked up form http://juliaimages.github.io/latest/install.html:

using TestImages, Images, ImageView
img = testimage(“mandrill”)
imshow(img)

was working fine yesterday morning but today I got an error:
Error encountered while loading “/home/arodionov/.julia/packages/TestImages/6bT9D/images/mandrill.tiff”.
Fatal error:
ERROR: InitError: error compiling init: could not load library “/home/arodionov/.julia/packages/ImageMagick/d5KBL/deps/usr/lib/libMagickWand-6.Q16.so”
/lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9’ not found (required by /home/arodionov/.julia/packages/ImageMagick/d5KBL/deps/usr/lib/libpng16.so.16)
Stacktrace:
[1] handle_error(::InitError, ::FileIO.File{FileIO.DataFormat{:TIFF}}) at /home/arodionov/.julia/packages/FileIO/Y0Lre/src/error_handling.jl:80
[2] handle_exceptions(::Array{Any,1}, ::String) at /home/arodionov/.julia/packages/FileIO/Y0Lre/src/error_handling.jl:75
[3] #load#27(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::FileIO.File{FileIO.DataFormat{:TIFF}}) at /home/arodionov/.julia/packages/FileIO/Y0Lre/src/loadsave.jl:193
[4] load(::FileIO.File{FileIO.DataFormat{:TIFF}}) at /home/arodionov/.julia/packages/FileIO/Y0Lre/src/loadsave.jl:172
[5] #load#13(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String) at /home/arodionov/.julia/packages/FileIO/Y0Lre/src/loadsave.jl:118
[6] load at /home/arodionov/.julia/packages/FileIO/Y0Lre/src/loadsave.jl:118 [inlined]
[7] macro expansion at ./logging.jl:315 [inlined]
[8] testimage(::String) at /home/arodionov/.julia/packages/TestImages/6bT9D/src/TestImages.jl:75
[9] top-level scope at none:0
during initialization of module ImageMagick

WHy>

Yes, I did Pkg.update() yesterday.

I’m running Version 1.0.2 (2018-11-08) on Ubuntu 16.

Anatoly Rodionov


Cairo rebuild demands root access?
#2

Unfortunately things are in an awkward state right now with regards to libz. Your best bet is to ensue that ImageMagick (or any other libz-loading package) loads before Gtk. You could do this:

using TestImages, Images, ImageMagick, ImageView   # put ImageView after ImageMagick
img = testimage(“mandrill”)
imshow(img)

or, if you’d rather not need to be explicit about ImageMagick,

using TestImages, Images
img = testimage(“mandrill”)
using ImageView
imshow(img)

Sorry for the inconvenience.


#3

Thank you so much Tim for you fast and helpful answer!

It works fine now.

Anatoly Rodionov