Julia VegaLite and ElectronDisplay - controlling sandboxing?

I’m using Julia 1.9.3 on WSL2 Ubuntu Linux, working through the REPL (actually through Emacs Julia-Snail, but the plotting commands are sent to the REPL). So wanted to try out ElectronDisplay for VegaLite.

using DataFrames
using VegaLite, VegaDatasets
using ElectronDisplay

dataset("cars") |>
    @vlplot(
        :point,
        x=:Horsepower,
        y=:Miles_per_Gallon,
        color=:Origin,
        width=400,
        height=400
    )

I get

FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn’t usable. Goodbye.

I think this is not Julia-specific, but I’ve read that using a --no-sandbox option is often the solution to this problem. Is there a way to control such an option with Julia?

Alternatively, I could view the figures in a browser. The plotting command above (without using Electron Display) generates the html file in /tmp/ - what command or environment variable is VegaLite/Julia looking for to automatically open this file - I imagine I can set it in my .bashrc?

I’m not sure whether ElectronDisplay can work when run on WSL… The electron process would be running inside the WSL virtual machine, and would then need the ability to display a UI etc. Maybe that could work with the relatively new gWSL or whatever that is… Have you tried to run other GUI programs in WSL and whether that works? That might be a good first start.

We could certainly add that. https://github.com/davidanthoff/Electron.jl/blob/master/src/Electron.jl#L133 provides the ability to add additional command line args, but we would have to modify ElectronDisplay.jl to actually use/expose that.

That logic is here, so I think on WSL that would essentially depend on what xdg-open does.

1 Like

Thanks for the answer. It seems like running an electron app on WSL2 is possible with installation of additional libraries (using X11 for the GUI - I’m using X410 but gWSL might be better), but I could not get it to work so I leave that for another day.

However, I can now view the output figures in the browser by specifying an appropriate program for xdg-open. Thanks for pointing me to that. On an Ubuntu Linux instance, the following worked for me and now the plot pops up in the Windows default browser.

$ sudo apt install wslu 
$ xdg-mime default wslview.desktop text/html
1 Like