ImageMagick.jl and PyPlot.jl conflicting libpng

on my macOS machine, I can trigger this with

julia> import ImageMagick

julia> import PyCall; PyCall.pyimport("matplotlib")

gives

ImportError('dlopen(/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/ft2font.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libpng16.16.dylib\n  Referenced from: /Users/goretkin/.julia/conda/3/lib/libfreetype.6.dylib\n  Reason: Incompatible library version: libfreetype.6.dylib requires version 51.0.0 or later, but libpng16.16.37.0.dylib provides version 16.0.0')
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/__init__.py", line 205, in <module>
    _check_versions()
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/__init__.py", line 190, in _check_versions
    from . import ft2font

Swapping the import order succeeds.

lsof on the failing instance reveals

/Users/goretkin/.julia/artifacts/654881cff259b8d4bdb16253badceb0e7c2abef7/lib/libpng16.16.37.0.dylib

lsof on the succeeding instance reveals

/Users/goretkin/.julia/conda/3/lib/libpng16.16.dylib
/Users/goretkin/.julia/artifacts/654881cff259b8d4bdb16253badceb0e7c2abef7/lib/libpng16.16.37.0.dylib

This is about the end of my understanding of dynamic linking, but I thought I could post here so that someone could [help me to] open the appropriate issue.

1 Like

Now between FFMPEG.jl and PyPlot.jl, with opposite ordering:

julia> import PyCall; PyCall.pyimport("matplotlib")
PyObject <module 'matplotlib' from '/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/__init__.py'>

julia> import FFMPEG
ERROR: InitError: could not load library "/Users/goretkin/.julia/artifacts/a6d3ce86d902a885e1e092882cb0ddb718aade03/lib/libass.9.dylib"
dlopen(/Users/goretkin/.julia/artifacts/a6d3ce86d902a885e1e092882cb0ddb718aade03/lib/libass.9.dylib, 1): Library not loaded: @rpath/libfreetype.6.dylib
  Referenced from: /Users/goretkin/.julia/artifacts/a6d3ce86d902a885e1e092882cb0ddb718aade03/lib/libass.9.dylib
  Reason: Incompatible library version: libass.9.dylib requires version 24.0.0 or later, but libfreetype.6.dylib provides version 23.0.0
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109
 [2] dlopen at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] __init__() at /Users/goretkin/.julia/packages/libass_jll/Ty9Kb/src/wrappers/x86_64-apple-darwin14.jl:46
 [4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:781
 [6] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [7] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:770
 [8] _require(::Base.PkgId) at ./loading.jl:1006
 [9] require(::Base.PkgId) at ./loading.jl:927
 [10] require(::Module, ::Symbol) at ./loading.jl:922
during initialization of module libass_jll

Importing FFMPEG first and then matplotlib does not cause the error, though it looks like there are errors downstream.

I have the same issue.

On Mac, with both

julia> using PyPlot

julia> using Plots

will error:

libass.9.dylib requires version 24.0.0 or later, but libfreetype.6.dylib provides version 23.0.0

You need to load first Plots and the PyPlot. Say whaaaaat. Yes, it works :smiley: