Keeping R packages needed for the extension in separate library #1728
Replies: 2 comments
|
Putting sess aside for the moment, languageserver itself depends on quite a few R packages. I think this makes dependency conflicts fairly likely when vscode-R is used together with an isolated project environment such as renv. So I expect we will eventually need something along the followings:
|
|
I am doing this now in rig: https://rig.r-lib.org/reference/proj.html#the-tools-package-library I.e. there is a separate user level library called I haven't used this for long, but it seems to work pretty well. Of course I still have a problem with 'sess' because I cannot install it myself, I cannot tell vscode-R to install it into the tools library, and I also cannot add it to the manifest. |
Uh oh!
There was an error while loading. Please reload this page.
I wonder if there is a good way to keep the R packages needed for the extension in a separate package library. I.e. {languageserver}, {sess} and (maybe) {processx} and their dependencies.
The motivation is that I am experimenting with implementing true virtual environments for R (as in Python and uv). In an R project with a virtual environment all packages (beyond base and recommended) are stored in
~/.rvenv/lib. The library path only has the project library and the system library:This does not work great when the extension tries to install {languageserver} and {sess}. I can set an extra library in
libPaths, and install {languageserver} there manually.But {sess} must be loaded into the interactive R sessions, so currently that and its dependencies (processx, ps, R6, later, Rcpp, rlang, jsonlite, rstudioapi) have to live in a library that is on the library path.
I wonder if anyone has ideas to improve this.
Maybe vscode-R could install all these packages into a separate library, and put that library on the library path as well, before the system library? Would you be willing to have a feature like this? It could be a single check box called "Keep vscode-R R packages in separate library". If this checkbox is set then 1) when {languageserver} or {sess} are missing, vscode-R would install them into an R version and platform dependent library, kept in the machine cache directory, and 2) would put this library on the
.libPaths(), before the system library.Of course I am also open to other suggestions.
All reactions