Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

savefig no longer works over ssh #1905

Open
jneem opened this issue Jan 29, 2019 · 14 comments
Open

savefig no longer works over ssh #1905

jneem opened this issue Jan 29, 2019 · 14 comments

Comments

@jneem
Copy link

jneem commented Jan 29, 2019

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.

@mkborregaard
Copy link
Member

do yuo have libqt5 on the server?

@jneem
Copy link
Author

jneem commented Jan 29, 2019

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.

@mkborregaard
Copy link
Member

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

@jneem
Copy link
Author

jneem commented Jan 29, 2019 via email

@mkborregaard
Copy link
Member

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

@jneem
Copy link
Author

jneem commented Jan 29, 2019

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.

@mkborregaard
Copy link
Member

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.

@jheinen
Copy link
Member

jheinen commented Jan 30, 2019

Could you please try:

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

@jneem
Copy link
Author

jneem commented Jan 30, 2019 via email

@jessebett
Copy link

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

@jheinen
Copy link
Member

jheinen commented Feb 27, 2019

Doesn't the workaround described in the #1905 (comment) 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!?

@jessebett
Copy link

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

@jheinen
Copy link
Member

jheinen commented Feb 27, 2019

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

@yha
Copy link
Member

yha commented Dec 21, 2021

Why was this closed? Was the issue solved at any point?
On the latest Plots and GR, plotting to a file through ssh without X (without the GKSwstype workaround) still crashes julia, although it can be done through GR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants