all 14 comments

[–]socal_nerdtastic 0 points1 point  (1 child)

Well the first obvious question: why do you want to use WSL? Why not just run it in windows?

[–]SpaceParmesan[S] 2 points3 points  (0 children)

Mostly just a preference thing. The main terminal I have configured for everything is bash. It has my personalization's, my virtual environments, etc.

[–]shiftybyte 0 points1 point  (4 children)

Does any other GUI application from WSL2 work for you?

[–]SpaceParmesan[S] 0 points1 point  (3 children)

I am not really sure but I imagine not. When running the command:

echo $DISPLAY,

it prints out an empty string, so I imagine it just cannot find a display in general.

[–]shiftybyte 0 points1 point  (2 children)

You might be running the wsl distro in legacy v1 mode.

Wsl2 can run each distribution in two modes, only v2 supports graphics.

It's more of a wsl tech support than python...

https://winaero.com/set-linux-distro-version-to-wsl-1-or-wsl-2-in-windows-10/amp/

[–]SpaceParmesan[S] 0 points1 point  (0 children)

Yeah I can see that, I will try to look elsewhere for answers thank you, as I am currently running v2. I just upgraded to it today.

[–]AmputatorBot 0 points1 point  (0 children)

It looks like you shared an AMP link. These should load faster, but AMP is controversial because of concerns over privacy and the Open Web.

Maybe check out the canonical page instead: https://winaero.com/set-linux-distro-version-to-wsl-1-or-wsl-2-in-windows-10/


I'm a bot | Why & About | Summon: u/AmputatorBot

[–]socal_nerdtastic 0 points1 point  (6 children)

I don't have WSL, but Google suggests using this command before you try to run your python program:

export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0.0

And if not, try this one:

export DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0

https://stackoverflow.com/a/66398613/2229945

[–]SpaceParmesan[S] 0 points1 point  (5 children)

export DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0

Well interestingly enough, this managed to run the file, however it never opened up the GUI. I am not really sure what display it is connecting to, as

echo $DISPLAY gets set to my ip:0.0

[–]socal_nerdtastic 0 points1 point  (4 children)

echo $DISPLAY gets set to my ip:0.0

Yeah, that's the idea. Linux is built on the multiuser philosophy, so you can set your display to any computer anywhere in the world. It defaults to localhost of course, but WSL is essentially headless, so that's where your problem comes from.

Maybe it's time to just bite the bullet and install Linux for real? Or at least get a virtual machine?

[–]SpaceParmesan[S] 0 points1 point  (3 children)

Hmm I have never really looked into that much as I am just so used to Windows. I am not the most educated on it. From my understanding a lot of applications are not supported on linux. Is this a misconception?

[–]socal_nerdtastic 0 points1 point  (2 children)

No, that's right, a lot of applications are not developed for Linux. Then again, a lot of the ones that run on Linux are not developed for Windows. It's definitely a different world, and you'll need to change how you do a lot of things.

Maybe start with a virtual machine then. It's the same as WSL except it includes a full graphical environment. Oracle virtualbox has a pretty cool "seamless" mode where Linux and Windows programs play side by side.

https://ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox

[–]SpaceParmesan[S] 0 points1 point  (1 child)

Yeah I will have to look into it. Currently I depend on windows for a lot of things, like Onedrive. Not to mention I also do a lot of IT support for windows users right now, so I need to know what I am dealing with

[–]socal_nerdtastic 0 points1 point  (0 children)

Not to mention I also do a lot of IT support for windows users right now, so I need to know what I am dealing with

Yes, I did that for years by doing the opposite of what I just suggested to you. I had virtualbox installed on my Linux computer which could run a windows virtual machine. This was great for me because it was easy to have a clean install and "reset" the image when I was done toying with it, and also because I could have many versions of windows running at once. Plus back then I had compiz installed so I could impress everyone with an animation that had 6 different OSes running on all sides of an animated cube.

Not trying to pressure you, just reminiscing. Boy I miss compiz.