IDE - Rstudio & Positron¶
Warning
Keep in mind that the cluster purpose is not to write/design code, but to use already produced code.
Use RStudio with Open On Demand (OOD)¶
Look at the dedicated page
Use Positron¶
You must follow the VSCode tutorial to run Positron on the cluster.
Positron enables to run R>=4.2. It is an alternative to RStudio.
Load R modules with RemoteSSH plugin¶
If you want to use R on the cluster thought Positron with remoteSSH extension, you will have some difficulties to use R versions available in modules.
Following this Positron issue, here the way to use them:
-
Look at documentation How_to_use_SLURM_R to known which R versions are available, but also which additional modules that are required to run them. As an example, you need to load module
compilers/gcc/12.2.0in addition to modulestatistics/R/4.4.3in order to use R 4.4.3. -
On your own computer, edit your Positron settings the following way to add the version of R you want from modules:
~/.config/Positron/User/settings.json 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
{ ..., "positron.environmentModules.environments": { "R 4.2.2": { "languages": ["r"], "modules": [ "statistics/R/4.2.2" ] }, "R 4.3.3": { "languages": ["r"], "modules": [ "statistics/R/4.3.3" ] }, "R 4.4.3": { "languages": ["r"], "modules": [ "compilers/gcc/12.2.0", "statistics/R/4.4.3" ] }, "R 4.5.0": { "languages": ["r"], "modules": [ "compilers/gcc/15.1.0", "statistics/R/4.5.0" ] } }, ... } -
Now you can connect to cluster from Positron with remoteSSH and select an R versions available in modules as an "Interpreter Session". It must be tagged as a module in the list, like
R 4.5.0 (Module: R 4.5.0). If it doesn't appears, please wait that Positron finishes to list environments available. Sometime you need to quit and launch again Positron to refresh the list.
Troubleshooting
When switching from a module to another module, or running another R session, you will get this error:
JEP 66 handshake failed for session r-db123456: Timeout waiting for handshake
You need to close Positron and run it again to fix the issue.
Conda/pixi¶
You can install your own version of R with conda or pixi. They can be used to manage your own version of R in addition to the one proposed by the facility.
Here an example where we create, from scratch, a reproducible project by using pixi and renv.
You must install pixi beforehand and enable it in Positron.
Keep in mind that the cluster purpose is not to write/design code, but to use already produced code.
# We create a projet directory with pixi (pixi must be installed before hand)pixi init my-pixi-r-project
# we install R in itcd my-pixi-r-project
pixi add r-base
# (optional) We create a Rsudio compatible projectpixi add r-usethis
pixi run R -e 'usethis::create_project(".",rstudio=TRUE)'
pixi rm r-usethis # cleanup
# We use renv to track our dependenciespixi run R -e 'install.packages("renv", repos=c("https://cloud.r-project.org")); renv::init()'
You can then open this project in Positron with RemoteSSH and work as usual.