jheinen / GR.jl

Plotting for Julia based on GR, a framework for visualisation applications
Other
357 stars 76 forks source link

Cannot Savefig with GR #552

Open brandonlivio opened 2 weeks ago

brandonlivio commented 2 weeks ago

I can plot but i cannot save plots with savefig. If I run the following

using GR
histogram(randn(1000))
savefig("test.png")

I get

GKS: dlopen(/Users/brandonlivio/.julia/artifacts/13233eebac72a288bd437e6b14efe6c24dfa0fc1/lib/cairoplugin.so, 1): Library not loaded: @rpath/libcairo.2.dylib
  Referenced from: /Users/brandonlivio/.julia/artifacts/13233eebac72a288bd437e6b14efe6c24dfa0fc1/lib/cairoplugin.so
  Reason: Incompatible library version: cairoplugin.so requires version 11603.0.0 or later, but libcairo.2.dylib provides version 2.0.0

I have tried everything, even completeley reinstalled julia, added only GR and the problem persists. I am running on Mac 11.7.10 and using Julia 1.11.0 (the latest stable release)

jheinen commented 2 weeks ago

Unfortunately, I could not reproduce the problem on any of our systems.

Could you please send us the versioninfo()?

julia> versioninfo()
Julia Version 1.11.0
Commit 501a4f25c2b (2024-10-07 11:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin22.4.0)
  CPU: 8 × Intel Core 2 Duo P9xxx (Penryn Class Core 2)
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, penryn)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
...
brandonlivio commented 2 weeks ago

Sure.

Julia Version 1.11.0
Commit 501a4f25c2b (2024-10-07 11:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin22.4.0)
  CPU: 8 × Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
jheinen commented 2 weeks ago

... an what are the environment settings for versioninfo(), e.g. (on my machine)

Environment:
  JULIA_DEPOT_PATH = /Users/jheinen/.julia:/usr/local/lib/julia
  JULIA_PKG_SERVER = us-west.pkg.julialang.org
brandonlivio commented 1 week ago

This is what I get if I run versioninfo(verbose = true) (is this what you where asking?)

Environment:
  TERM = xterm-256color
  PATH = /Users/brandonlivio/.juliaup/bin:/usr/local/bin:/usr/local/bin:/Users/brandonlivio/anaconda3/bin:/Users/brandonlivio/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Library/TeX/texbin:/Applications/Julia-1.10.app/Contents/Resources/julia/bin/
  XPC_FLAGS = 0x0
  HOME = /Users/brandonlivio
jheinen commented 1 week ago

Unfortunately, I can't explain this behavior. GR also works with Julia 1.11.1 in exactly the same configuration. Using otool -L (during a Julia session using GR) we get the same version numbers :

 run(`otool -L /usr/local/lib/julia/artifacts/a0531a464438ac052eca7a5126d330a266b3cc30/lib/cairoplugin.so`)
/usr/local/lib/julia/artifacts/a0531a464438ac052eca7a5126d330a266b3cc30/lib/cairoplugin.so:
    @rpath/cairoplugin.so (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libcairo.2.dylib (compatibility version 11603.0.0, current version 11603.0.0)
    @rpath/libjpeg.62.dylib (compatibility version 62.0.0, current version 62.4.0)
    @rpath/libtiff.6.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
    @rpath/libfreetype.6.dylib (compatibility version 24.0.0, current version 24.4.0)
    @rpath/libpixman-1.0.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libpng16.16.dylib (compatibility version 16.0.0, current version 16.44.0)
    @rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.3.1)
Process(`otool -L /usr/local/lib/julia/artifacts/a0531a464438ac052eca7a5126d330a266b3cc30/lib/cairoplugin.so`, ProcessExited(0))

julia> run(`otool -L /usr/local/lib/julia/artifacts/210d443a7c5fea7d01dd33a1d093d76e47dc9fd5/lib/libcairo.dylib`)
/usr/local/lib/julia/artifacts/210d443a7c5fea7d01dd33a1d093d76e47dc9fd5/lib/libcairo.dylib:
    @rpath/libcairo.2.dylib (compatibility version 2.0.0, current version 2.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
    @rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.3.1)
    @rpath/libpng16.16.dylib (compatibility version 16.0.0, current version 16.44.0)
    @rpath/libfontconfig.1.dylib (compatibility version 14.0.0, current version 14.0.0)
    @rpath/libfreetype.6.dylib (compatibility version 27.0.0, current version 27.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0)
    @rpath/libpixman-1.0.dylib (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1463.2.1)
    /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
Process(`otool -L /usr/local/lib/julia/artifacts/210d443a7c5fea7d01dd33a1d093d76e47dc9fd5/lib/libcairo.dylib`, ProcessExited(0))

The only difference is, that we use a shared Julia environment (in /usr/local/lib/julia) - but this shouldn't matter.

Do you probably have a ~/.julia/config/startup.jl file which (pre-)loads other packages?