Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot attach R in WSL #910

Closed
monovich opened this issue Dec 11, 2021 · 1 comment
Closed

Cannot attach R in WSL #910

monovich opened this issue Dec 11, 2021 · 1 comment
Labels

Comments

@monovich
Copy link

Describe the bug

I am getting a Cannot find R client bug whenever I attempt to pass code to an R session in WSL. I am using WSL2 (Ubuntu 20.04). I'd like to setthe Rpath / Rterm to the WSL versions of R/radian not the Windows versions of R/radian. Currently nothing I have tried works correctly.

To Reproduce
Steps to reproduce the behavior:

Everything is stock freshly installed. Pathing to WSL /usr/bin/R doesn't have any effect with or without prepending the wsl path in either the Linux or Windows Rterm/Rpath settings. When I had R installed on windows .vsc.attach() worked as expected, but I've since removed it.

Do you want to fix by self? (We hope your help!)

Yes?

(If yes,) what kind of help do you want? (e.g. Which file should I fix, Survey (related documents)

I need direction on how to set up the extension with WSL2 properly

(If related)setting.json

// R.exe path for windows
"r.rterm.windows": "C:/windows/system32/wsl.exe /usr/bin/R",

This works fine to open an R session from powershell.

// R path for Linux
"r.rterm.linux": "/usr/bin/R",

// R command line options (i.e: --vanilla)
"r.rterm.option": [],

// An optional encoding to pass to R when executing the file, i.e. 'source(FILE, encoding=ENCODING)'
"r.source.encoding": "UTF-8",

// Keeping focus when running
"r.source.focus": "editor",

// Use active terminal for all commands, rather than creating a new R terminal
"r.alwaysUseActiveTerminal": false,

// Use bracketed paste mode
"r.bracketedPaste": true,

// Enable R session watcher
"r.sessionWatcher": true,

// Delay in milliseconds before sending each line to rterm (only applies if r.bracketedPaste is false)
"r.rtermSendDelay": 8,

Expected behavior

I should be able to open an R session in WSL2 through the extension by pointing to the WSL2 R/radian versions

Environment (please complete the following information):

  • OS: Windows_NT x64 10.0.19041
  • VSCode Version: 1.63.0
  • R Version: 4.1.2
  • vscode-R version: v2.3.4
@monovich monovich added the bug label Dec 11, 2021
@monovich
Copy link
Author

Whelp. Leave it to me to post an issue then immediately figure out a solution. If you open VSCode on windows in WSL2 via code . to scope things to your current location, the VSCode window that opens now thinks its in a Linux environment, so providing a rterm/rpath in the Linux settings actually works as intended.

This should probably be added to installation documentation somewhere, because in hindsight its rather obvious, but potentially confusing to a new user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants