REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.07k stars 128 forks source link

Did not receive a response from VSCode-R API within 5 seconds #1019

Open kenhanscombe opened 2 years ago

kenhanscombe commented 2 years ago

Hi,

On an HPC SLURM compute node, I'm getting

r$> devtools::load_all()                                                                                                                                                                         
Error in request_response("rstudioapi", action = action, args = list(...)) : 
  Did not receive a response from VSCode-R API within 5 seconds.

I think the last change I made was to ~/.Rprofile, adding

Sys.setenv(TERM_PROGRAM = "vscode")

source(file.path(
    Sys.getenv(
        if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"
    ),
    ".vscode-R", "init.R"
))
renkun-ken commented 2 years ago

Do you open your workspace via remote-ssh? If not, then you should not put the script in you ~/.Rprofile.

kenhanscombe commented 2 years ago

Yes, I'm using remote-ssh.

It works from the login node, but fails from an interactive slurm job.

renkun-ken commented 2 years ago

It is a known limitation at the moment that if vscode-R extension is running on a server which does not have direct access to the filesystem where the interactive R terminal is started, then vscode-R session watcher won't work.

kenhanscombe commented 2 years ago

If I understand correctly then, vscode-R session watcher cannot be used on an HPC compute node (SLURM srun)? Setting "r.session.emulateRStudioAPI": false clears the error. Should I undo any other changes?

Kdreval commented 1 year ago

It seems that after the recent VS Code version update to 1.75.1 this is also affecting non-slurm nodes and gives the same error message on a regular remote ssh. The solution of setting r.session.emulateRStudioAPI to false appears to still work.

nathaneastwood commented 1 year ago

I'm currently having this issue. I haven't changed anything that I'm aware of.

Version: 1.78.2 (user setup) Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435 Date: 2023-05-10T14:39:26.248Z Electron: 22.5.2 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19045 Sandboxed: Yes

vscode-r: v2.8.0

languageserver: 0.3.15

This is on my local machine. I'm not routing into any server.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 365 days with no activity.

kleinbub commented 3 months ago

I'm also having the same issue on a clean install following vscode-R setup guide, when using devtools::build() on a local package (so no networking/virtualization) This happens to me exclusively using radian, instead when using the default R terminal the command works as expected. setting r.session.emulateRStudioAPI to false does fix the issue, allowing the command to succeed with radian as well.

REditorSupport.r v.2.8.4 radian v0.6.12se R v4.4.0 languageserver 0.3.16

jialul commented 3 months ago

I also run into the same issue with the latest R version (v2.8.4). I downgraded to v2.8.1 and restarted R and it works for me now.