Plots.jl: savefig no longer works over ssh

Created on 29 Jan 2019  Â·  13Comments  Â·  Source: JuliaPlots/Plots.jl

I used to be able to ssh into a remote machine (without X forwarding) and plot figures using savefig. This no longer works:

julia> using Plots

julia> savefig(histogram([1, 2, 3]), "test.pdf")
gksqt: cannot connect to X server
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

Of course, I don't expect to be able to view plots without X forwarding, but I do expect to be able to save them.

Here is my versioninfo:

julia> versioninfo()
Julia Version 1.0.2
Commit d789231e99 (2018-11-08 20:11 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)

GR is version 0.37.

Most helpful comment

Could you please try:

ENV["GKSwstype"]="100"
using Plots
plot(rand(10))
savefig("out.png")

All 13 comments

do yuo have libqt5 on the server?

Yes:

$ ls /usr/lib/libQt*.so
/usr/lib/libQt3Support.so                 /usr/lib/libQt5WebChannel.so
/usr/lib/libQt5Concurrent.so              /usr/lib/libQt5WebKit.so
/usr/lib/libQt5Core.so                    /usr/lib/libQt5WebKitWidgets.so
/usr/lib/libQt5DBus.so                    /usr/lib/libQt5Widgets.so
/usr/lib/libQt5EglFSDeviceIntegration.so  /usr/lib/libQt5X11Extras.so
/usr/lib/libQt5EglFsKmsSupport.so         /usr/lib/libQt5XcbQpa.so
/usr/lib/libQt5Gui.so                     /usr/lib/libQt5XmlPatterns.so
/usr/lib/libQt5Location.so                /usr/lib/libQt5Xml.so
/usr/lib/libQt5MultimediaGstTools.so      /usr/lib/libQtAV.so
/usr/lib/libQt5MultimediaQuick.so         /usr/lib/libQtAVWidgets.so
/usr/lib/libQt5Multimedia.so              /usr/lib/libQtCLucene.so
/usr/lib/libQt5MultimediaWidgets.so       /usr/lib/libQtCore.so
/usr/lib/libQt5Network.so                 /usr/lib/libQtDBus.so
/usr/lib/libQt5OpenGL.so                  /usr/lib/libQtDeclarative.so
/usr/lib/libQt5PositioningQuick.so        /usr/lib/libQtDesignerComponents.so
/usr/lib/libQt5Positioning.so             /usr/lib/libQtDesigner.so
/usr/lib/libQt5PrintSupport.so            /usr/lib/libQtGui.so
/usr/lib/libQt5Qml.so                     /usr/lib/libQtHelp.so
/usr/lib/libQt5QuickParticles.so          /usr/lib/libQtMultimedia.so
/usr/lib/libQt5Quick.so                   /usr/lib/libQtNetwork.so
/usr/lib/libQt5QuickTest.so               /usr/lib/libQtOpenGL.so
/usr/lib/libQt5QuickWidgets.so            /usr/lib/libQtScript.so
/usr/lib/libQt5Script.so                  /usr/lib/libQtScriptTools.so
/usr/lib/libQt5ScriptTools.so             /usr/lib/libQtSql.so
/usr/lib/libQt5Sensors.so                 /usr/lib/libQtSvg.so
/usr/lib/libQt5Sql.so                     /usr/lib/libQtTest.so
/usr/lib/libQt5Svg.so                     /usr/lib/libQtXmlPatterns.so
/usr/lib/libQt5Test.so                    /usr/lib/libQtXml.so
/usr/lib/libQt5TextToSpeech.so

You'll notice that gksqt doesn't print any errors about missing libraries (which it did before I installed qt). Instead, it prints an error about failing to connect to an X server.

wow, not sure then. could you try a different backend?

I just tried PyPlot, and it worked fine.

On Tue, Jan 29, 2019 at 1:06 PM Michael Krabbe Borregaard <
[email protected]> wrote:

wow, not sure then. could you try a different backend?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/JuliaPlots/Plots.jl/issues/1905#issuecomment-458666208,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABYYsVH_VSkuKE83lxR35gywRhh8ok9mks5vIJu3gaJpZM4aYc6r
.

Could you try GR without Plots? Sounds like this might be a GR issue, not a Plots one.

Not having ever used plain GR before, I may be doing this wrong. However, I successfully got a pdf to appear like this

julia> import GR
julia> GR.inline("pdf")
"pdf"
julia> GR.histogram([1, 2, 3])
Union{}
julia> savefig("test.pdf")

The GR.inline("pdf") line is necessary; if I leave it out, I get error messages like those above. So it appears like GR is capable of producing plots without an X server, but the way it's getting invoked from JuliaPlots requires an X server.

Great, thanks a lot for the detective work. @jheinen do you have any idea? I'm pretty sure we haven't changed the way GR generates figures in a long time.

Could you please try:

ENV["GKSwstype"]="100"
using Plots
plot(rand(10))
savefig("out.png")

That works, thanks!

On Tue, Jan 29, 2019 at 7:45 PM Josef Heinen notifications@github.com
wrote:

Could you please try:

ENV["GKSwstype"]="100"using Plotsplot(rand(10))savefig("out.png")

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/JuliaPlots/Plots.jl/issues/1905#issuecomment-458778817,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABYYseMb4ywGLxGGAZs0lWQ1VEpj-CYUks5vIPlBgaJpZM4aYc6r
.

I'm also getting this error as described by @jheinen

Doesn't the workaround described in the https://github.com/JuliaPlots/Plots.jl/issues/1905#issuecomment-458778817 solve the problem? I could add another environment (GKS_NO_GUI or whatever) to indicate, that we are on a headless system. Alternatively, I could generate a warning- that's AFAIK what MPL does (sth like "... no GUI backend available") - instead of an error!?

Oh, I see, I needed to have done this in a fresh session, before using Plots.

Btw, this is what I get if I don't use the workaround, which seems excessive...

julia> using Plots

julia> plot(x->x)
QXcbConnection: Could not connect to display
Aborted (core dumped)
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 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 TEXT
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE

That's "normal" behaviour on a headless display. I should probably show one message only and/or disable GUI output internally.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PallHaraldsson picture PallHaraldsson  Â·  4Comments

jebej picture jebej  Â·  4Comments

SebastianM-C picture SebastianM-C  Â·  4Comments

lstagner picture lstagner  Â·  5Comments

dancsi picture dancsi  Â·  4Comments