JupyterLab: Difference between revisions

Jump to navigation Jump to search
R Kernel installation procedure
(Fixed one prompt prefix)
(R Kernel installation procedure)
Line 228: Line 228:


=== R Kernel ===
=== R Kernel ===
''(Section under construction. Please see the older [[JupyterNotebook#R|configuration procedure here]])''
Prerequisites:
# Configuring an R kernel still depends on a Python virtual environment that already has all the '''[[JupyterLab#Python_Kernel|Python Kernel]]''' dependencies. If you do not have such virtual environment, make sure to follow instructions listed in the previous section.
# Since the installation of R packages requires an access to '''[https://cran.r-project.org/ CRAN]''', the configuration of an R kernel must be done in a '''[[SSH|remote shell session on a login node]]'''. For example, from a local terminal or any SSH client: {{Command2|prompt=[my_computer ~] $|ssh username@cluster_address}}
Once you have a Python virtual environment available, you may configure the R kernel:
 
<ol>
<li>Activate the Python virtual environment. {{Command2|source $HOME/jupyter_py3.8/bin/activate}}
<li>Load an R module. {{Command2|prompt=(jupyter_py3.8) [name@server ~]$|module load r/4.1}}
<li>Configure the installation directory for R packages. {{Command2|prompt=(jupyter_py3.8) [name@server ~]$|mkdir -p ~/.local/R/$EBVERSIONR/ && export R_LIBS{{=}}$HOME/.local/R/$EBVERSIONR/}}
<li>Install the R kernel dependencies (note: this may take up to 10 minutes). {{Command2|prompt=(jupyter_py3.8) [name@server ~]$|R -e "install.packages(c('crayon', 'pbdZMQ', 'devtools'), repos{{=}}'http://cran.us.r-project.org')"}}
<li>Install the R kernel. {{Command2|prompt=(jupyter_py3.8) [name@server ~]$|R -e "devtools::install_github(paste0('IRkernel/', c('repr', 'IRdisplay', 'IRkernel')))"}}
<li>Install the R kernel spec file. {{Command2|prompt=(jupyter_py3.8) [name@server ~]$|R -e "IRkernel::installspec()"}}
<li>Deactivate the virtual environment and close the remote session: {{Command2|prompt=(jupyter_py3.8) [name@server ~]$|deactivate && exit}}
<li>Start or restart a new JupyterLab session.
</ol>
 
For more information, see the [https://irkernel.github.io/docs/ IRKernel documentation].


== Possible error messages == <!--T:30-->
== Possible error messages == <!--T:30-->
cc_staff
782

edits

Navigation menu