Unable to display plot using the REPL. GKS errors

It seems that the Qt5 run-time is missing on your laptop.

sudo apt-get install qt5-default

should fix the problem.

11 Likes

If this doesn’t help, ensure that the GR run-time is up-to-date:

ENV["GRDIR"] = ""
Pkg.build("GR")
5 Likes

It worked, thanks a lot!

1 Like

Thanks for posting. I had same error with new Ubuntu 18.04.1 LTS distro / Julia 1.0.3. installing qt5-default resolved issue.

2 Likes

I met this error. but i use gentoo not debian so i cannot run apt install. how can i do to solve this problem?

Use whatever mechanism Gentoo prefers for installing software (I think it is called emerge, but I never used Gentoo much).

error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory

i have installed qtgui-5.13.2 in my gentoo. but it still display this error… i wanna try to whether updating qtgui can solve this error…

i have update qtgui to 5.14.1-r4. it still return this error. :frowning:

The GR backend is trying to fall back to Qt4, but you have installed Qt5. Did you do the above-mentioned rebuild of GR.jl after the latest install of Qt5?

] build GR

i have builded GR. is it wrong? what should i do?

let me try to make sciapp/gr…

although it has an error qt.qpa.xcb: QXcbConnection: XCB error: 146 (Unknown), sequence: 201, resource id: 0, major code: 139 (Unknown), minor code: 20 , but the figure appears successful! thanks!

Is there any workaround for those of us who need to work on machines that we don’t have sudo access to?

Also why does GR require Qt5? I’m running completely headless…

On headless systems, pls set the environment GKS_WSTYPE to nul or 100.

1 Like

I tried both of these settings but they give me an error:

ERROR: LoadError: SystemError: opening file "/tmp/jl_CdHheQ.png": No such file or directory
Stacktrace:
 [1] systemerror(::String, ::Int32; extrainfo::Nothing) at ./error.jl:168
 [2] #systemerror#50 at ./error.jl:167 [inlined]
 [3] systemerror at ./error.jl:167 [inlined]
 [4] open(::String; read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing) at ./iostream.jl:254
 [5] open at ./iostream.jl:246 [inlined]
 [6] open(::Base.var"#279#280"{String}, ::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./io.jl:296
 [7] open at ./io.jl:296 [inlined]
 [8] read at ./io.jl:381 [inlined]
 [9] _show(::IOStream, ::MIME{Symbol("image/png")}, ::Plots.Plot{Plots.GRBackend}) at /home/skainswo/.julia/packages/Plots/VA7Vx/src/backends/gr.jl:1970
 [10] show at /home/skainswo/.julia/packages/Plots/VA7Vx/src/output.jl:215 [inlined]
 [11] png(::Plots.Plot{Plots.GRBackend}, ::String) at /home/skainswo/.julia/packages/Plots/VA7Vx/src/output.jl:7
 [12] frame(::Plots.Animation, ::Plots.Plot{Plots.GRBackend}) at /home/skainswo/.julia/packages/Plots/VA7Vx/src/animation.jl:20
 [13] frame(::Plots.Animation) at /home/skainswo/.julia/packages/Plots/VA7Vx/src/animation.jl:18
 [14] top-level scope at /home/skainswo/dev/research/julia/odecontrol/diffdrive/train.jl:89
 [15] include(::Module, ::String) at ./Base.jl:377
 [16] exec_options(::Base.JLOptions) at ./client.jl:288
 [17] _start() at ./client.jl:484
in expression starting at /home/skainswo/dev/research/julia/odecontrol/diffdrive/train.jl:48

Also, is there documentation for this somewhere?

EDIT: Tried a value of 140 as suggested in https://github.com/JuliaPlots/Plots.jl/issues/1612 and that worked :man_shrugging: Magic numbers galore!

Sorry - my fault. I didn’t realize that you are using Plots. That’s an example for headless systems:

ENV["GKSwstype"] = "nul"
using Plots
plot(rand(10))
savefig("foo.png")
5 Likes

I am also getting these errors:

julia> plot(rand(10))
/home/affans/.julia/packages/GR/Atztx/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application

GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS

Setting ENV["GKSwstype"] = "nul" or ENV["GKSwstype"] = "140" works but plot(rand(10)) dosn’t really do anything (I am using an X-server to pop up the image from my server to local). So anyway I can get this to work on a server (without sudo access, so can’t install Qt5Widgets.so.5) and with x-forwarding?

ENV[“GKSwstype”] = “nul”

This did the trick for me! Thanks!

For gentoo users :slight_smile:
euse -p sci-visualization/gr -E cairo
emerge --ask --verbose sci-visualization/gr
source /etc/profile

1 Like

What should do ?
should I install qt5 or is it code?