How to Run Julia Online and Create an Interactive Scene/Figure Window using Makie/GLMakie/WGLMakie on Codespaces or JuliaHub

I am trying to run my code online, verifying if people would be able to test my Simulation online without having to download Julia on their devices.

How do I use GLMakie or WGLMakie to create a Scene/Figure displayed in a popup window that I can pan around in and all that that I can usually do?

Have you tried a simple VSCode REPL with WGLMakie? I think WGLMakie works on JuliaHub but it might not extend to ipynbs because each of those modes has its own problems with getting the necessary network connections set up

@jules is right about the notebook :wink:

I just tested JuliaHub with the Plotpane:

Seems to work :slight_smile: It can also open a new tab, if you disable the plotpane.
There seems to be an issue that VSCode’s automatic port forwarding only triggers on second display, or that the the display(fig) waits for you to open the website, if it isn’t automatically opened by VSCode.
You may also need to update Bonito.jl to the newest version, there was one version in the last weeks which likely broke this.

I can confirm that WGLMakie does NOT work with Jupyter Notebooks in JuliaHub (it does work locally) due to some issue with port forwarding that I am unable to understand.

But when Using the REPL, the code more or less works. That is really unfortunate. However, there are still a few hiccups.

For some reason, if I create 2 Scenes one after the other, I am unable to access the first one with all its objects and unable to add the the first scene after the second scene has been created. This however is not the case in normal Julia, from my understanding (I may be wrong), the Display sessions are independent of the Scene Objects in Julia.

Even more, and I guess this is what you were telling me, Simon, display does not work.

There does exist some port forwarding. But like in the case of the Jupyter Notebooks, the port forwarding does not work correctly…

@sdanisch How could you please explain more on this issue? Is this replicable? How do you make the display work? How do I update Bonito since it is not within my Julia environment? And is the Scene behaviour expected?

Also, just curious, where are these Screens added?
I am guessing these are unforwarded Screens, just getting rendered on the JuliaHub Node running this code.

Ha, interesting that GLMakie works out of the box.
They’re in a colorbuffer.
You can also enable the Plotpane and use GLMakie.activate!(inline=true).

The all fields need to be isbits error should be fixed in the next big Makie release.
The hanging on error is really annoying - there are sadly a couple of code paths that can lead to this and I thought i found them all, but obviously didn’t.

For updating bonito, just add it to your environment? Or is that not possible?

unable to add the the first scene after the second scene has been created

I’m not sure what you mean exactly, but the bonito error that makes things hang is due to your second explicit display. Until the new release, you can work around that error by not displaying the scene a second time.
I guess that prohibits you from switching between them?

Bonito.jl was not present in the environment to begin with. Adding it doesn’t really do anything.

I guess I’ll have to wait for a new release to get this issue fixed.

Thank you so much Simon!