Help using GLMakie or WGLMakie on ssh

Hi everyone.
I need to make some 3D plots for which I cannot use Cairomakie. My local machine is a windows computer to which I connect via vscode-ssh to a linux computer.
I would be happy to just generate a png with either WGLMakie or GLMakie, although it also would be nice to makie interactivity work. Likewise, if anyone knows how to make it work with either vscode or basic ssh in the shell that would be very helpful (ultimately, I want to use vscode)

My problem manifests in the following way:

WGLMakie: Everything seems to work fine until I try to display, or save a figure. Then the REPL hangs for a while and after 1 minute or so it errors with

ERROR: Can't get three: Screen Session uninitialized. Not yet displayed? Session status: CLOSED, id: c4d32250-d752-4496-9306-13ef9e9533d6
Waiting for plot to be initialized in display

I suppose it needs to be able to render something in order to save it but I can’t make it work. In the docs, I only find the following:

If you want to use WGLMakie in VS Code on a remote server, you will have to forward the port used by WGLMakie in order for the plot pane integration to work. If you don’t need to change the port, you will just have to forward the 9384 port.

I have done that, but it doesn’t seem to do anything. It seems one can also use Bonito.jl to change the port. I tried to do that as well but also with no effect: Neither saving works nor displaying in the browser or vscode pane.

GLMakie: Here, I also have some similar issues. I can run ssh with x11 forwarding.

Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to “/storage/niggeni/.julia_aquana/compiled/v1.10/GLMakie/jl_XUFhA4”.
┌ Warning: OpenGL/GLFW wasn’t loaded correctly or couldn’t be initialized.
│ This likely means, you’re on a headless server without having OpenGL support setup correctly.
│ Have a look at the troubleshooting section in the readme:
│ Makie.jl/GLMakie at master · MakieOrg/Makie.jl · GitHub.
â”” @ GLMakie ~/.julia/packages/GLMakie/fj8mE/src/gl_backend.jl:4
ERROR: LoadError: InitError: Exception[GLFW.GLFWError(65550, “X11: Failed to open display localhost:16.0”), ErrorException(“glfwInit failed”)]

This indicates that I still need to set up OpenGL properly, but I am not sure what exactly I am missing. FWIW: If I run GLMakie locally, it seems to work. It also works if I use another linux machine to connect to the server.

Does anyone have experience in setting up either WGLMakie or GLMakie with a remote connection and could help me?

1 Like

Try forwarding the port WGLMakie uses to localhost:

ssh -L 9384:localhost:9384 user@server

In Julia

using WGLMakie
scatter(1:4)

And then open:

http://localhost:9384/browser-display

I’m not sure how to optimize this work flow - I guess we should at least document it.
The problem is, that Bonito.jl runs: Bonito.HTTPServer.openurl("http://localhost:9384/browser-display") internally, which at least succeeds on my server, without opening a browser on the client.
If it would fail, we could notify the user about it going wrong instead of waiting for the browser to load the display :frowning:

1 Like

My situation is even worse: I don’t have the permission of forwarding the port. Ideally, I just want to save the picture as a file on the remote server, without the need to see it in a browser.

thanks for the explanation.
Its still not quite working for me unfortunately:

julia> scatter(1:4)
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
connect localhost port 6000: Connection refused
ERROR: MethodError: no method matching isclosed(::Nothing)

I have forwarded port 9384, not sure what to do with port 6000. Is this something I should configure with Bonito?

You should be able to do that with CairoMakie!

I’m not sure either - I don’t think this is printed by anything in the Bonito stack.
Is there anything special in the setup that’s relevant for making the connection?
What does the browser say, in which you open the browser-display?

1 Like

Ok it seems to be solved now. I am not fully sure what exactly did it, but if it helps anyone, I will include the steps I did:

First off:

I’m not sure either - I don’t think this is printed by anything in the Bonito stack.
Is there anything special in the setup that’s relevant for making the connection?
What does the browser say, in which you open the browser-display?

At first it showed nothing, but after waiting for the REPL to throw the error (about 10 seconds after displaying the plot), it actually gave the error “your graphics card does not support WGL” (or something equivalent)

  • yesterday, while debugging, I installed the OpenCL™, OpenGL® und Vulkan® Compatibility Pack
  • After seeing the error above, I realized that I did not restart my computer yet. So I did that.
  • After rebooting I still had the same error in the browser window (edge). I decided to switch to another browser (Firefox) in which it worked!
  • Now it also works in VSCode (after adding the line LocalForward 9384 localhost:9384 to my ssh config)

In conclusion it was either the browser, the missing compatibility pack, or perhaps both.

Thanks a lot for the help!

1 Like

Thanks, but unfortunately, CairoMakie doesn’t support 3D volume plot right now.

Have you tried this from the GLMakie docs?

It’s a pretty old article but should still work the same

I am not sure if I understand the rationale behind WGLMakie, and I thought maybe you are facing the same using as me (not sure).
In my case, the remote machine has no GPU, thus OpenGL cannot be correctly installed and GLMakie cannot be used. But when I want to plot some 3D figures using the data stored in the remote machine, I can use WGLMakie, which set up a server remotely but doing the plotting locally using broswer.
Is my understanding right? Looking forward to your reply!

Disclaimer: not an expert!

I think both WGLMakie and GLMakie use gpu, the only difference is that WGLMakie is based on WebGL which is designed to play nice with browsers. For GLMakie you need to enable X11 Forwarding, i.e. allowing information from graphic applications to be forwarded.

That being said im not sure if a (dedicated) GPU is necessary for GLMakie to work. It might be enough for the cpu to emulate a GPU. For instance I can run GLMakie on a Microsoft surface which I think does not have a GPU.

But would be interesting if anyone has more info on that

I have used WGLMakie yesterday with a virtual machine having no GPU. (The url didn’t work but I got an interactive plot inside VSCode)

The idea behind WGLMakie is a Makie backend that works well with browsers, web apps, javascript and that kind of stuff. This is why WGLMakie can be used with browser based tools like Jupyter notebooks and Pluto notebooks.

I have tried this:

  • ssh -L to a remote node and start up a pluto server
  • open the brower locally, accessing the remote pluto sever via ssh
  • plot using WGLMakie and succeed (partially): I can plot 3D figures, but they are not interactive as displayed here
    Do you have any ideas?

Have you tried this WGLMakie | Makie

There is also a description of WGLMakie here WGLMakie | Makie