All Products
Search
Document Center

Platform For AI:Install R Kernel in DSW

Last Updated:Apr 26, 2024

Data Science Workshop (DSW) of Platform for AI (PAI) is integrated with open source JupyterLab. You can install R Kernel on a DSW instance by using conda. Then, you can use R script in Notebook to train models. This topic describes how to install R Kernel on a DSW instance.

Prerequisites

A DSW instance is created. For more information, see Create a DSW instance.

Procedure

  1. Go to the development environment of Data Science Workshop (DSW).

    1. Log on to the PAI console.

    2. In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.

    3. In the upper-left corner of the page, select the region where you want to use PAI.

    4. In the left-side navigation pane, choose Model Development and Training > Interactive Modeling (DSW).

    5. (Optional.) On the Interactive Modeling (DSW) page, enter the name of a DSW instance or a keyword in the search box to search for the DSW instance.

    6. Find the DSW instance and click Launch in the Actions column.

  2. On the Launcher tab, click Terminal in the Text and terminal section.

  3. Run the following code to create and install R Kernel:

    conda create -n r-kernel
    source activate r-kernel
    conda install r-recommended r-irkernel
    conda install Jupyter
    R -e 'IRkernel::installspec()'
    jupyter-notebook
    Note
    • We recommend that you write and execute the code by line.

    • If the Proceed ([y]/n) message appears during code execution, enter y and then press the Enter key.

    • If the conda:not found error message appears when you run the following command, conda is not installed in the image environment. You must install conda on the DSW instance by running the following command:

      $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
      $ bash Miniconda3-latest-Linux-x86_64.sh
      $ source ~/.bashrc
  4. Go back to the Launcher tab to check whether the R environment is available.

    image.png If the R environment is available, you can use the R programming language in the Notebook of the instance.