Closed korsbo closed 3 years ago
I should add that this used to work just fine (at least in VSCode) but it broke a couple of weeks ago and I don't quite know what caused it to break.
Hey @korsbo and @DNF2,
how did you set up GR.jl
in VSCode before? Do other graphical applications (like vlc
) work in WSL2? I am not sure, but I suppose that the Qt libraries are missing and they are not shipped with the GR binaries.
Ok, I can reproduce the problem on Windows 10 21H1, with Ubuntu in WSL2 and Julia 1.6.2. Installing Qt5 libraries does not help. This probably needs some deeper debugging.
A long-ish time ago, I was using an X-server on windows that I forwarded stuff to in order to get plots, etc, working. For the last year or so though, I've been using VSCode and everything seems to have been taken care of for me. I don't know what magic this entailed but I no longer needed to set anything up to get graphics working.
I have now tried to update/rebuild GR on a real windows version of Julia too (no WSL), hoping that this would set things up correctly, but without success. Plotting works on windows but still not on WSL2.
... but without success. Plotting works on windows ...
Using GR with the native Julia (1.6.2) version should work out of the box. What do you mean with "no success" vs. "Plotting works on Windows"?
My primary dev environment is on my WSL2 Ubuntu subsystem, running a Linux kernel under Windows. That's where I get the segfaults.
Just to pin down the error better, I also installed Julia straight under Windows, without being in the WSL subsystem. There, GR works just fine but I instead loose out of alot of the benefits that a Linux kernel provides.
Seems like GUI support is still only available in Windows preview versions (WSLg): https://devblogs.microsoft.com/commandline/the-initial-preview-of-gui-app-support-is-now-available-for-the-windows-subsystem-for-linux-2/ You probably used Xming before?
I seem to get the same problem on github actions https://github.com/baggepinnen/ControlSystemIdentification.jl/runs/3387766476?check_suite_focus=true#step:4:1375
After installing VcXsrv I get this result:
I tried Xming first, but it does not work with recent Qt versions.
So, I needed these steps to succeed:
DISPLAY
variable:
export DISPLAY="$(route.exe print | grep '\b0.0.0.0\b' | awk '{ print $4 }'):0.0"
julia
und use GR :slightly_smiling_face:@baggepinnen In a CI pipeline, it is probably better to use another output format. You can set
export GKS_WSTYPE=png
to produce a PNG file instead (gks.png
), but other types are also possible (for example PDF
for vector graphics). Use GKS_FILEPATH
to set another filename.
I think that @IngoMeyer441's solution is pretty spot-on, thank you!. I Also found a simple VSCode-specific solution that does not require running an X-server. Setting "julia.usePlotPane": true
got everything working again.
I think that the perplexing bit of my issue was that plotting used to work in VSCode until I somehow managed to disable usePlotPane
. When that happened, the plotting reverted back to trying to open an external plot - something I had not enabled support for. Since plotting then failed both on VSCode and in a separate REPL (which presumably never worked, I had just not tried it) I did not identify the issue as a VSCode issue.
So, problem solved. Thanks for your help and for your work on the lovely GR.jl package!
Hi, I'm getting segfaults when I try to plot using GR (directly or via Plots.jl) on a Linux subsystem (WSL2, ubuntu) on Windows. I seem to get the same problem in both an external terminal and within VSCode. I tried nuking the
.julia/compiled
and.julia/artefacts
folders but that did not help.Any ideas on how I might fix this?
Thanks!