Table of Contents |
---|
...
How do I create a custom Rstudio Environment?
A custom Rstudio environment requires some manipulation from the command-line so that you can create what is know as a custom module collection named "ood_rstudio". The basic ingredients for your custom Rstudio environment include:
(Required) A version of R you wish to use
Additional modules that fulfill the dependencies for the R libraries you wish to install
Install the R library. Steps on how to perform an
install.packages
on Mana can be found here.Creating a collection with the specific name "ood_rstudio"
For example, if one wanted to use rgdal within rstudio, they would need to also add the gdal module to their custom collection and install the R library. The steps would be as follows
Custom Rstudio environment
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
[user@login002 ~]$ srun -p sandbox -c 4 --mem=6g -t 60 --pty /bin/bash [user@node-0005 ~]$ module purge [user@node-0005 ~]$ module load langllang/RStudio-Server/20222023.0712.21+576402-fossgfbf-2022a2023b-Java-11-R-4.24.1 [user@node-0005 ~]$ module load data/GDAL/3.59.0-foss-2022a2023b [user@node-0005 ~]$ R [user@node-0005 ~]$ # Perform install.packages in R of rgdal and exit R [user@node-0005 ~]$ module save ood_rstudio [user@node-0005 ~]$ exit |
...
While Rstudio is setup where it can only have a single customized environments, Jupyter * can have multiple custom environments. This is possible because each custom environment is a self contained conda environment which is loaded as a unique Kernel.
Custom Jupyter Kernel
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
[user@node-0005 ~]$ module purge [user@node-0005 ~]$ module load lang/Anaconda3 [user@node-0005 ~]$ mamba create --name test_env python=3 [user@node-0005 ~]$ source activate test_env [user@node-0005 ~]$ ### Install your required packages ### [user@node-0005 ~]$ # ... [user@node-0005 ~]$ ### Finalize setup with this last package ### [(test_env) user@node-0005 ~]$ mamba install ipykernel [(test_env) user@node-0005 ~]$ python -m ipykernel install --user --name test_env --display-name "test_env" [(test_env) user@node-0005 ~]$ exit |
...
A custom Jupyter environment requires some manipulation from the command-line so that you can create a custom conda environment named "ood_jupyterlab" that contains the custom version of jupyter you require.
Customized Jupyter Environment
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
[user@node-0005 ~]$ module purge [user@node-0005 ~]$ module load lang/Anaconda3 [user@node-0005 ~]$ mamba create -n ood_jupyterlab -c conda-forge jupyterlab=3 xeus-python [user@node-0005 ~]$ exit |
...
The reason for this is because Jupyter applies all parameters from a global config file and those specified at runtime https://jupyterlab.readthedocs.io/en/latest/user/directories.html#labconfig-directories.
For example:, if you have ".jupyter/jupyter_server_config.py", you will want to rename it to something like ".jupyter/jupyter_server_config_custom.py" and call it specifically in the cases you wish to utilize it in any Jupyter instances you launch outside of Open OnDemand when using Mana.
...