vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

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

Open kenhanscombe opened this issue 3 years ago • 10 comments

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"
))

kenhanscombe avatar Mar 01 '22 13:03 kenhanscombe

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

renkun-ken avatar Mar 01 '22 13:03 renkun-ken

Yes, I'm using remote-ssh.

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

kenhanscombe avatar Mar 02 '22 08:03 kenhanscombe

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.

renkun-ken avatar Mar 02 '22 08:03 renkun-ken

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?

kenhanscombe avatar Mar 02 '22 11:03 kenhanscombe

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.

Kdreval avatar Feb 22 '23 19:02 Kdreval

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.

nathaneastwood avatar Jun 06 '23 10:06 nathaneastwood

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

github-actions[bot] avatar Jun 06 '24 01:06 github-actions[bot]

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

kleinbub avatar Jun 20 '24 12:06 kleinbub

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.

jialul avatar Jul 02 '24 13:07 jialul

Also experiencing this on my local machine. Also only experience it when using radian.

halidaee avatar Feb 03 '25 18:02 halidaee