GR.jl icon indicating copy to clipboard operation
GR.jl copied to clipboard

no visible plot in "GR in Gtk" example GR.jl/examples/gtk_ex.jl, create_bits_image_internal fails

Open cmey opened this issue 3 years ago • 13 comments

using GR
include(joinpath(pathof(GR), "../../examples/gtk_ex.jl"))
Screen Shot 2021-03-10 at 1 17 52 PM

Reading the code, I expect a hexbin plot instead of the gray panel?

This message gets printed:

*** BUG ***
In pixman_image_t *create_bits_image_internal(pixman_format_code_t, int, int, uint32_t *, int, pixman_bool_t): The expression bits == NULL || (rowstride_bytes % sizeof (uint32_t)) == 0 was false
Set a breakpoint on '_pixman_log_error' to debug

When I move the mouse, the coordinates update.

julia> versioninfo()
Julia Version 1.6.0-rc1
Commit a58bdd9010 (2021-02-06 15:49 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 4

(myenv) pkg> st GR
      Status `~/Code/julia/trading/Project.toml`
  [28b8d3ca] GR v0.55.0

(myenv) pkg> st Gtk
      Status `~/Code/julia/trading/Project.toml`
  [4c0ca9eb] Gtk v1.1.6

cmey avatar Mar 10 '21 12:03 cmey

BTW, GR works well by itself:

x = randn(100000)
y = randn(100000)
hexbin(x, y, nbins=30)

Screen Shot 2021-03-10 at 1 23 46 PM

cmey avatar Mar 10 '21 12:03 cmey

I could not reproduce the problem on macOS 11.2.3 or CentOS 8.3.2011 with Julia 1.5.3:

Could you please post the following output:

using GR
grdir = ENV["GRDIR"]
run(`otool -L $grdir/lib/gtkplugin.so`)

I don't think it's a problem with the Julia version. Are you probably using multiple Gtk versions on you system? (MacPorts, Homebrew, ...)

jheinen avatar Mar 10 '21 16:03 jheinen

Thank you for your prompt response! Here is what you asked:

$ /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia --project=.
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0-rc1 (2021-02-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using GR

julia> grdir = ENV["GRDIR"]
"/Users/cmeyer/.julia/packages/GR/9Vi4m/src/../deps/gr"

julia> run(`otool -L $grdir/lib/gtkplugin.so`)
/Users/cmeyer/.julia/packages/GR/9Vi4m/src/../deps/gr/lib/gtkplugin.so:
	gtkplugin.so (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
Process(`otool -L /Users/cmeyer/.julia/packages/GR/9Vi4m/src/../deps/gr/lib/gtkplugin.so`, ProcessExited(0))

I don't think I have a Gtk installed via Homebrew.

$ brew info gtk
gtk+: stable 2.24.33 (bottled), HEAD
GUI toolkit
https://gtk.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gtk+.rb
[...]

I don't think I have MacPorts installed at all (never used it).

$ port
zsh: command not found: port

cmey avatar Mar 10 '21 16:03 cmey

Screen Shot 2021-03-10 at 5 43 28 PM

cmey avatar Mar 10 '21 16:03 cmey

Just to be sure: Could you check the GR run-time version?

using GR; version()

If your run-time version is ≥ 0.55.0, I will have to setup a Julia 1.6 environment on a newly installed system.

jheinen avatar Mar 10 '21 19:03 jheinen

$ /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia --project=.
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0-rc1 (2021-02-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using GR; version()
"0.55.0"

cmey avatar Mar 11 '21 09:03 cmey

I deleted my ~/.julia, tried with julia 1.5.3, from a clean julia env added only Gtk and GR, and ran gtk_ex.jl. Getting the same exact issue!

cmey avatar Mar 11 '21 09:03 cmey

I thought maybe my PATH or LD_LIBRARY_PATH env vars would be causing an issue. I cleaned them down to export PATH=/usr/bin:/bin:/usr/sbin and export LD_LIBRARY_PATH=, then retried the above again. Still the same issue.

cmey avatar Mar 11 '21 09:03 cmey

Also tried unplugging my external monitors. Same.

cmey avatar Mar 11 '21 09:03 cmey

Both GR and Gtk tests (pkg> test Gtk GR) all pass. There is only a warning produced during Gtk tests:

(<unknown>:3896): Gtk-WARNING **: 15:58:40.970: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/check-symbolic.svg.
This may indicate that pixbuf loaders or the mime database could not be found.
file info contains: 13

cmey avatar Mar 11 '21 15:03 cmey

The latest release of Gtk did not help this issue. [4c0ca9eb] ↑ Gtk v1.1.6 ⇒ v1.1.7

cmey avatar Mar 18 '21 13:03 cmey

I have a similar issue on my Windows machine, but with a couple other issues:

  • Window will not appear on screen at all with Gtk.set_gtk_property!(win, :double_buffered, false)
  • Error that it can't find the temporary svg if ENV["GKS_WSTYPE"] = "142" is present

If both of those are commented out, the window renders but no plot.

GR alone works and displays in the VSCode Plots pane.

BioTurboNick avatar Nov 03 '21 20:11 BioTurboNick

See also #367, I think there's a logic error in GR.jl.

BioTurboNick avatar Nov 04 '21 02:11 BioTurboNick