Monday, May 6, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 780  / 2 Years ago, mon, may 9, 2022, 8:49:27

I can't run gnuplot x11 terminal from Ubuntu 20.04 from Microsoft Store. I installed Ubuntu from Microsoft Store, then I installed VcXsrv. Then I run Xlaunch (VcXsrv) - choose display settings multiple windows, Start no client (I also tried with parameter -ac), then I choose Clipboard, Primary selection and native opengpl and finish. Then I run Ubuntu from Microsoft Store on terminal write export DISPLAY=localhost:0.0 then gnuplot then set terminal x11 and I get error
Terminal type is now 'x11'
Options are ' nopersist enhanced'
gnuplot>
gnuplot: unable to open display 'localhost:0.0'
gnuplot: X11 aborted.
Why?
enter image description here


I try to do this like here but it doesn't work
Gnuplot display on Bash on Ubuntu on Windows 10



 Answers
5

You don't specify, but it sounds like you are running WSL2. The post you linked to was from over 4 years ago when only WSL1 existed. They are quite different.


While WSL1 shared the same network as the Windows host, WSL2 uses a virtual network that is NAT'd behind the Windows host, inside part of the Hyper-V subsystem.


As a result, attempting to connect to localhost won't work, since localhost isn't the Windows host.


Instead, use:


export DISPLAY="$(hostname).local:0.0"

That uses the mDNS name of the Windows host to obtain the correct IP, which usually works. If not, there are more complicated export DISPLAY strings that can be tried.


[#743] Wednesday, May 11, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
njuash

Total Points: 402
Total Questions: 125
Total Answers: 98

Location: Jersey
Member since Sun, Dec 4, 2022
1 Year ago
njuash questions
Wed, Jun 8, 22, 11:53, 2 Years ago
Wed, Nov 30, 22, 11:42, 1 Year ago
Mon, May 30, 22, 04:33, 2 Years ago
Mon, Apr 10, 23, 03:40, 1 Year ago
;