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

Failed to get list of R functions. Make sure that `jsonlite` is installed... #1325

Closed wsteenhu closed 6 months ago

wsteenhu commented 1 year ago

Describe the bug When connected remotely to the HPC of our institution (remote-SSH), and running R, I keep on getting the following error messages when hovering over R-code:

  1. Failed to get list of R functions. Make sure that jsonlite is installed and r.rpath.linux points to a valid R executable.
  2. Error in loadNamespace("jsonlite") : there is no package called ‘jsonlite’ Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart Execution halted

jsonlite is installed and r.path.linux should point to a valid R executable (on the remote).

I suspect there is an issue with the local (\C\Users\<username>\AppData\Roaming\Code\User\settings.json)vs remote (~/.vscode-R/settings.json) settings.json-files, resulting in these warnings/errors. Maybe VS code locally looks for jsonlite and the R executable, which it cannot find. Of note, it seems apart from these constant pop-ups, code execution goes well. Something similar has been described here, but I cannot find a solution to my problem.

To Reproduce Steps to reproduce the behavior:

  1. Connect to remote using remote-SSH
  2. Start R through conda environment
  3. Toggle 'R' OR command pallette 'R: create R terminal'
  4. Open .Rmd-file and click in/hover over code.

Can you fix this issue by yourself? (We appreciate the help)

No, but I really think local and remote settings.json files are clashing.

(If yes,) can we assist you with anything?

Yes, I would really like to have R smoothly working on the HPC-server (without these very annoying popups).

(If applicable) Please attach setting.json

Local settings.json (see path above)

{
    "r.bracketedPaste": true,
    "r.sessionWatcher": true,
    "r.alwaysUseActiveTerminal": true,
    "r.rpath.linux": "/exports/para-lipg-hpc/wsteenhu/conda-envs/R4.2.2/bin/R",
    "r.rterm.linux": "/exports/para-lipg-hpc/wsteenhu/conda-envs/R4.2.2/bin/R",
    "files.associations": {
        "*.Rmd": "rmd"
    },
    "remote.SSH.remotePlatform": {
        "res-hpc-lo02": "linux"
    },
}

Remote settings.json (see path above)

{"rpath":{"windows":"","mac":"","linux":"/exports/para-lipg-hpc/wsteenhu/conda-envs/R4.2.2/bin/R"},"rterm":{"windows":"","mac":"","linux":"/exports/para-lipg-hpc/wsteenhu/conda-envs/R4.2.2/bin/R","option":["--no-save","--no-restore"]},"libPaths":[],"lsp":{"enabled":true,"args":[],"promptToInstall":true,"debug":false,"diagnostics":true,"lang":"","use_stdio":false},"rmarkdown":{"codeLensCommands":["r.runCurrentChunk","r.runAboveChunks"],"enableCodeLens":true,"chunkBackgroundColor":"rgba(128, 128, 128, 0.1)","preview":{"autoRefresh":true},"knit":{"useBackgroundProcess":true,"focusOutputChannel":true,"openOutputFile":false,"command":"rmarkdown::render","defaults":{"knitWorkingDirectory":"document directory"}}},"helpPanel":{"enableSyntaxHighlighting":true,"cacheIndexFiles":"None","previewLocalPackages":["."],"rpath":"","enableHoverLinks":true,"clickCodeExamples":{"Click":"Copy","Ctrl+Click":"Run","Shift+Click":"Ignore"}},"source":{"encoding":"UTF-8","echo":false,"focus":"editor"},"alwaysUseActiveTerminal":true,"bracketedPaste":true,"removeLeadingComments":false,"sessionWatcher":true,"session":{"watchGlobalEnvironment":true,"objectLengthLimit":2000,"objectTimeout":50,"levelOfObjectDetail":"Minimal","emulateRStudioAPI":true,"data":{"rowLimit":0,"pageSize":500},"viewers":{"viewColumn":{"plot":"Two","browser":"Active","viewer":"Two","pageViewer":"Active","view":"Two","helpPanel":"Two"}}},"rtermSendDelay":8,"workspaceViewer":{"showObjectSize":false,"removeHiddenItems":false,"clearPrompt":true},"liveShare":{"timeout":10000,"defaults":{"commandForward":false,"shareWorkspace":true,"shareBrowser":false}},"plot":{"devArgs":{"width":800,"height":1200},"useHttpgd":false,"defaults":{"colorTheme":"original","plotPreviewLayout":"multirow","fullWindowMode":false},"timing":{"resizeInterval":100,"refreshInterval":10},"customStyleOverwrites":""}}

Expected behavior The messages should not appear. Please note, I currently run R through a conda installation, but previously the same thing happened when using a module including R. In addition, on a previous HPC (also working remotely through SSH), I had the same issues (so apparently, I consistently do not have the correct settings).

Screenshots image

Environment (please complete the following information):

Additional context

wsteenhu commented 1 year ago

It seems that indeed, the error arises because vscode-R starts looking for packages locally (instead of on remote). Setting the r.libPaths-setting to the local R-library indeed solves the issue (no popups anymore). This however does not seem like desired behaviour.

albertosantini commented 1 year ago

(dup https://github.com/REditorSupport/vscode-R/issues/1307 ?)

github-actions[bot] commented 6 months ago

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

github-actions[bot] commented 6 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.