# Unable to Plot in REPL

**URL:** <https://discourse.julialang.org/t/unable-to-plot-in-repl/13535>\
**Category:** New to Julia\
**Created:** [August 15, 2018, 11:32pm UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535 "2018-08-15T23:32:04Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![hjohnston7](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@hjohnston7](https://discourse.julialang.org/u/hjohnston7)\
**Post date:** [August 15, 2018, 11:32pm UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/1 "2018-08-15T23:32:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [August 16, 2018, 4:26am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/2 "2018-08-16T04:26:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hjohnston7](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@hjohnston7](https://discourse.julialang.org/u/hjohnston7)\
**Post date:** [August 17, 2018, 6:11pm UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/3 "2018-08-17T18:11:36Z")

</div>

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](https://discourse.julialang.org/t/unable-to-display-plot-using-the-repl-gks-errors/12826/2), but it did not work.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [August 17, 2018, 6:38pm UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/4 "2018-08-17T18:38:02Z")

</div>

For openSUSE, you have to install the requirements as described in the installation instructions ([Julia Package GR — GR Framework 0.66.0 documentation](https://gr-framework.org/julia.html)):

```bash
zypper install libXt6 libXrender1 libXext6 Mesa-libGL1 libQt5Widgets5

```

---

<div class="post-metadata">

**Author:** ![hjohnston7](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@hjohnston7](https://discourse.julialang.org/u/hjohnston7)\
**Post date:** [August 19, 2018, 8:25pm UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/5 "2018-08-19T20:25:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [August 20, 2018, 7:38am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/6 "2018-08-20T07:38:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hjohnston7](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@hjohnston7](https://discourse.julialang.org/u/hjohnston7)\
**Post date:** [August 21, 2018, 1:44am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/7 "2018-08-21T01:44:17Z")

</div>

The following was the output that I got:

> hunter @ linux-ga1c ~/.julia/packages/GR/crXzk/deps/gr/bin  
> └─ $ ▶ ./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  
> └─ $ ▶ ld gksqt  
> ld: error in gksqt(.eh\_frame); no .eh\_frame\_hdr table will be created.

---

<div class="post-metadata">

**Author:** ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Post date:** [August 21, 2018, 1:56am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/8 "2018-08-21T01:56:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hjohnston7](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@hjohnston7](https://discourse.julialang.org/u/hjohnston7)\
**Post date:** [August 21, 2018, 2:40am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/9 "2018-08-21T02:40:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [August 21, 2018, 3:32am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/10 "2018-08-21T03:32:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Post date:** [August 21, 2018, 5:17am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/11 "2018-08-21T05:17:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hjohnston7](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@hjohnston7](https://discourse.julialang.org/u/hjohnston7)\
**Post date:** [August 22, 2018, 2:51am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/12 "2018-08-22T02:51:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gevis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gevis/32/11737_2.png) [@gevis](https://discourse.julialang.org/u/gevis)\
**Post date:** [April 9, 2020, 10:29am UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/13 "2020-04-09T10:29:11Z")

</div>

I’ve got exactly the same error message in Gentoo Julia REPL while trying to plot(rand(100)) except for that instead of the following string:

> [@hjohnston7](#):
>
> crXzk

I have yMV3y. However, I think that it is set randomly. The installed version of Julia is 1.3.0. The ~/.julia/packages/GR/yMV3y/deps/build.log file says that GR has been dowloaded pre-compiled though I have used pkg\> build GR.  
$ eix libqt command finds only dev-libs/libqtxdg package. Any ideas how to let the plot(rand(100)) command work in my Julia REPL on Gentoo? P.S. I am also going to ask this question on gentoo-user mailing list and point them here.

---

<div class="post-metadata">

**Author:** ![sajad\_ghassemi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sajad_ghassemi/32/25241_2.png) [@sajad\_ghassemi](https://discourse.julialang.org/u/sajad_ghassemi)\
**Post date:** [May 20, 2021, 10:45pm UTC](https://discourse.julialang.org/t/unable-to-plot-in-repl/13535/14 "2021-05-20T22:45:09Z")

</div>

I have the same problem . How can I install package libqt4 ???
