Libraries
Here are paths under various settings:
# vs code extension paths
R library paths:
"/home/rstudio/.cache/R/renv/library/Prac23StatsSeecCourseSimpleReg-ebd2789b/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu"
"/home/rstudio/.cache/R/renv/sandbox/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/25ebdc09"
Error in loadNamespace("jsonlite") :
there is no package called ‘jsonlite’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
# renv paths
"/workspaces/.local/.cache/R/renv/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu"
"/home/rstudio/.cache/R/renv/sandbox/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/25ebdc09"
# renv paths (with sandbox disabled)
"/workspaces/.local/.cache/R/renv/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu"
"/usr/local/lib/R/library"
# non-renv paths:
"/workspaces/.local/lib/R"
"/usr/local/lib/R/site-library"
"/usr/local/lib/R/library"
what worked (with sandbox enabled)
- In workspace directory, run
radian --vanilla
- Run the following:
lib_path <- "/home/rstudio/.cache/R/renv/sandbox/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/25ebdc09"
install.packages(
c("jsonlite", "languageserver"),
lib = lib_path,
repos = "https://cloud.r-project.org"
)
No matter how I start R, by default I install into libraries not used by the VS Code extension.
The workaround in future is just to start R in vanilla mode, and install languageserver and jsonlite, explicitly installing into the paths indicated by the VS Code R extension.
To use the above code then, just replace the value of lib_paths with the relevant value.
Libraries
Here are paths under various settings:
what worked (with sandbox enabled)
radian --vanillaNo matter how I start R, by default I install into libraries not used by the VS Code extension.
The workaround in future is just to start
Rin vanilla mode, and installlanguageserverandjsonlite, explicitly installing into the paths indicated by the VS Code R extension.To use the above code then, just replace the value of
lib_pathswith the relevant value.