Windows 10 Bash "Cannot connect to display!"

I have recently installed Bash for Windows 10 (yay!). I need it to run my processing software called 'Seismic Unix' which installed fine. However, when I ran the command attached, it gave this error "Cannot connect to display!". This command is supposed to display an image on the screen, and I think the Bash cannot access my laptop screen in order to display the results.

A screenshot of the error "Cannot connect to display!"

screenshot

Here is the command:

suplane | suximage title="My first test" &

I look forward to hearing from you, and thank you in advance.


You need to install an "X server" to provide that graphical interface which is yet not there on a typical Ubuntu subsystem on windows 10.

If you install an X server application on your Windows desktop and change a setting in the Bash shell, applications will send their graphical output to the X server application and they’ll appear on your Windows desktop.

You can install Xming a good X server for Windows. Just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.

After installation you’ll need to set the DISPLAY environment variable to point at the X server already running on your system.

First run the following command in the Bash environment to set the DISPLAY variable:

export DISPLAY=:0

and then run your graphical application. In this case

suplane | suximage title="My first test" &

Some part is taken from howtogeek


The current best solution I have found is to download MobaXterm and use the local bash terminal through mobaXterm and all of the graphics forwarding is handled by the windows side, currently WSL doesnt handle and GUI stuff.

I was using a mac at work and a windows machine at home, I set up WSL and was trying to work with jupyter notebooks but having the same issue "Cannot connect to X server" when launching images through matplotlib even if I had the cygwin X server running the WSL was not aware of it. After a bit of digging I saw a thread recommending mobaXterm, works a treat now.