Unable to Plot in REPL


#1

When I try to plot something in the Julia REPL, I am getting the following error messages.

julia> ENV[“GRDIR”] = “”
“”

julia> using Pkg

julia> Pkg.build(“GR”)

Building GR → “~/.julia/packages/GR/crXzk/deps/build.log”

julia> using Plots

julia> gr()
Plots.GRBackend()

julia> plot(rand(20))
/home/hunter/.julia/packages/GR/crXzk/src/…/deps/gr/bin/gksqt: error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can’t connect to GKS socket application
Did you start ‘gksqt’?

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
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine FILLAREA
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine FILLAREA
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE

I have already tried the solution in


#2

Can you tell which version of Julia are you using? Try version() in the REPL and share it to us. On the other hand it just works for me for a fresh install. I just needed to install Plots.jl, Pkg.add("Plots"), and nothing else. Note that Plots.jl will install GR as the default backend


#3

Thanks for the reply! It looks like I accidentally submitted the post before finishing. I am using Julia 1.0.0, and I have installed it on openSUSE Tumbleweed. I have previously had this problem on Julia 0.6.4, too. I tried to follow the instructions in this post, but it did not work.


#4

For openSUSE, you have to install the requirements as described in the installation instructions (https://gr-framework.org/julia.html):

zypper install libXt6 libXrender1 libXext6 Mesa-libGL1 libQt5Widgets5

#5

Thanks @jheinen, but unfortunately that did not solve the problem. I am still getting:

GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine FILLAREA

whenever I try to use GR as the plotting backend. Is there something else that could be causing an error?


#6

Are there any system error message when gksqt is started, especially from the loader (ld) - missing libraries etc,?


#7

The following was the output that I got:

hunter @ linux-ga1c ~/.julia/packages/GR/crXzk/deps/gr/bin
└─ $ :arrow_forward: ./gksqt
./gksqt: error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory

hunter @ linux-ga1c ~/.julia/packages/GR/crXzk/deps/gr/bin
└─ $ :arrow_forward: ld gksqt
ld: error in gksqt(.eh_frame); no .eh_frame_hdr table will be created.


#8

When libQtGui.so.4 is not available, it’s most likely GR is not properly built. I ran into that recently. Check the log file “~/.julia/packages/GR/crXzk/deps/build.log” and see if it got to 100%.

Otherwise, rm GR (and you might have to remove the GR folder under .julia, I guess), and then add GR again.


#9

It looks like the build got to 100%, but I went ahead and removed GR and added it again. I am still getting the same errors.


#10

The generic Linux build (which is used on openSuSE) is built against Qt4. Could you pls try to install libQt4Widgets4? I don’t have an up-to-date openSuSE system - may be the name (libQt4Widgets4) is different.


#11

Sorry, I was misreading your error message. You definitely need Qt4 on your system.


#12

Installing the package libqt4 fixed the problem. Thanks for all your help!