RStudio Desktop 1.3.1004 Bionic Build with R 4.0.0 on WSL2 up and running remote x via X410


Based on the same premises as used when doing RStudio Desktop on Docker it works. I don't have an 'easy' setup other than going through and installing everything needed but this is much easier using WSL2 than it was on 1.

Let's just hope it is more stable. :slight_smile:

I don't really have much to say on the 'how' you can do it to other than to say it is doable and I wanted to report it for all the other do-it-yourselfers out there.

Hi,

Could you elaborate a bit more on how to do it? This sounds very interesting!
I just spent the whole day installing and playing with WSL2 (since it's part of the Windows 10 May 2020 update) and installed R on there as well.

I'm really interested in combining the RStudio experience with the WSL2 as for my research I have several programs that run on Linux and I like to call them via the system command in R. Although in RStudio I can set the terminal to WSL and run my commend there, when I use the system command, it does not send it to WSL because it uses my windows R version I think...

I hope RStudio might take a renewed interest in this now Windows made it easier to run Linux, as I read in a related post it has been very difficult for them to get this working in the past

PJ

I have no doubt in my mind that the RStudio team will "support" WSL in the future. As stated in the last post of the thread you linked it has been a moving target, but that is changing and the use cases will continue to grow. I wouldn't be surprised to see the ability to target a WSL R installation from RStudio running on Windows someday soon(ish). Having RStudio Desktop running on Windows but using the standard Linux build system instead of being RTools dependent is a GoodThing.

As for elaborating more on how I set it up...
I went through setting up the WSL Ubuntu pretty much the same way as for RStudio on Docker so if you already had an older version properly running the GUI then it shouldn't be any different as far as that is concerned. As it relates to your executed R it shouldn't be sending that to WSL as the RStudio Desktop app is installed on the WSL instance. Take a look at what environment is being used when you issue a system() call via the R console from your WSL installed RStudio Desktop app. (ie system(printenv)) and make sure everything is pointing to your WSL install.
I personally don't have R installed on the Windows side so I am not positive if a call to R will get handled by the interop system in preference to the WSL instance (can't imagine it would).

1 Like

Hi @pieterjanvc. I'm going to wipe my machine soon and upgrade to WSL2 soon too. Big improvements over current WSL.

The trick is to use MobaXTerm, or another shell environment for WSL that has X11. I think there are others, but of all the WSL terminals I've tried, Moba is the best. You can have multiple tabs open, and lots of other stuff. The one thing I have an issue with is mouse integration in the terminal with scrolling.

In current WSL, I have only been able to install RStudio Desktop v1.1.463 or earlier. Others have had the same problem. I can run newer versions of RStudio Server, but that's not my preferred environment.

I'm hoping that the usual installation methods will work in WSL2.

Let me know if I can offer any more help!

Hi @abalater

Thanks for the response! You seem to have much more experience with this than me :slight_smile:

I've been working with Linux mostly just to use software in research that's not available on windows or that needs to be run on a larger cluster of computers given the memory / space constraints.

My goal would be to be able to use RStudio to write / test my code, but be able to integrate some Linux commands using the system() function. So either I like to be able to run RStudio's GUI fully on the WSL2, or have my windows version connection to the R instance that's running on WSL (or even only the system commands running on there, as the R can be Windows too).

It's all too new and confusing at the moment, so I'll probably wait a bit more until more experienced people like you have had the time to explore the new WSL2 and maybe even get the RStudio team look into this and see if there is a future in which they might make this possible.

Definitely keep me posted!

PJ

I run RStudio Desktop as a GUI application in WSL. I just type rstudio at the command line and it opens. I had to install an older version, but used the usual methods. In WSL2, with the most recent version of Ubuntu, you might be able to install the current version. I'm hoping so. It wasn't a problem with Ubuntu. It was a problem with some tiny alteration to Ubuntu in WSL.

You can also look up the remoteR package that lets you use RStudio Desktop locally, but run your code on a remote server.

Finally, if you cluster managers will allow you to, you could (or they could) install RStudio Server on the cluster. Then you would be working right on the cluster.

1 Like

Hi,

Thanks for the tips!
I also read this Windows blog

It seems that soon (that hopefully means next few months) WSL2 will support GPU hardware acceleration and we can just run the GUI straight from Linux...

PJ

1 Like

Posted a gist with the essentials to get going. I use X410 as my X server but other than that I can't think of anything that'd be different in a default Win 10 May 2004 system. Hope it helps show how straight forward it can be to get going by just cutting and pasting a few commands.

It would have been nifty to have made a script but I just made this and ran through it to answer a few questions I have gotten.

A very basic, no-frills, setup of RStudio on WSL2

It takes less than 10 minutes to install (copy/paste step-by-step) on my system which is

UserBenchmarks:
Game 25%, Desk 74%, Work 57%
CPU: AMD Ryzen 5 2400G - 78%
GPU: AMD RX Vega 11 (Ryzen iGPU) - 17.3%
SSD: Samsung 860 Evo 500GB - 109.5%
RAM: Unknown TEAMGROUP-UD4-3000 2x8GB - 93.4%
MBD: Gigabyte AB350M-DS3H

Anyhow... have fun!

edit:

Thank You, Thank You, Thank You To the RStudio Team! You make my R life a :smiley: one!
Particularly that TinyText... OMG... the time savings... :tears-of-joy:

1 Like

Hey @Thell thanks for the gist--I'm using WSL1 and have x11 working for Nautilus but not for RStudio for some reason. I get an exec format error whenever I try to launch it--do you have any idea what might be going on?

edit, wanted to add this just in case:

 ~/tmp $ file /usr/lib/rstudio/bin/rstudio
/usr/lib/rstudio/bin/rstudio: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=7267d72ee2e5c5c9fbd67a3e65e1b6bf0e568351, stripped

~/tmp $ arch
x86_64

Hey @Thell thanks for the gist--I'm using WSL1 and have x11 working for Nautilus but not for RStudio for some reason. I get an exec format error whenever I try to launch it--do you have any idea what might be going on?

Uhhh, yes, I have an idea what is going on but you aren't going to like it...

RStudio Desktop on WSL1 used to work many versions ago, but as several threads and issue comments will mention it hasn't worked for quite some time and this is one of the common errors seen.
If you want to have RStudio via WSL then the supported way would be to use RStudio Server. If you want RStudio Desktop then you'd need to jump back a long way (I forget just how long ago it was that it worked OK) or update your WSL. If I recall correctly someone had even built from source back when it stopped working and that didn't fix it so... :man_shrugging:

[edit] Upon thinking about it I'm not even sure that using RStudio Server within WSL would be a 'supported' setup.

oof, yes, I saw that RStudio Desktop v1.1.463 seems to work but that's very old. I'm on a machine that is managed in an enterprise environment on build 1909 so I can't get WSL2 yet.

I may try VSCode out for now or try to see which version of rstudio-server will work for me. Or, I could just use the windows versions of things, but I'll miss my zsh shell :sob:

An RStudio Support posting!

What's nifty is that if you

  • step 4: add libnss3
  • step 5: change from the server to the desktop client
    https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.3.1056-amd64.deb
  • step 6: start using
    DISPLAY=$(ip r l default | cut -d\ -f3):0.0 rstudio &

You'll see a warning msg about a directory not existing that can be safely ignored.

A more full-fledged setup would include quite a bit more but that is true of the server example too.

When we see Visual Studio Community having the capability to work with WSL2 along with VSCode, well, I'm just happy to see a RStudio Support post mentioning it!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.