Integrating RStudio Server Pro with Jupyter Notebooks, Launcher, and Slurm#

Info

Launcher is a new feature of RStudio Server Pro 1.2 that is only available under named user licensing. RStudio Server Pro 1.2 without Launcher is available under existing server-based licensing. For questions about using Launcher with RStudio Server Pro, please contact sales@rstudio.com.

Overview#

These steps describe how to integrate RStudio Server Pro with Jupyter Notebooks running with Launcher and Slurm.

Prerequisites#

This integration is intended to be performed on top of an installation of RStudio Server Pro that has already been configured with Launcher and Slurm.

Step 1. Ensure that Python is available on each node#

  • Ensure that Python is available on each node in the Slurm cluster.

    • If needed, you can install Python, pip, and virtualenv on each node following the steps to Install Python.

      Info

      Our recommended installation instructions for Python allow you to make multiple versions of Python available and avoid replacing existing versions of Python when updating system packages.

Step 2. Install Jupyter Notebooks, JupyterLab, and Python packages on each node#

  • From the previous step, you should still have the PYTHON_VERSION environment variable defined with the version of Python that you installed.

    • If not, you can define this environment variable before proceed by running the following command and replacing 3.7.7 with the version of Python that you are using:

      Terminal
      $ export PYTHON_VERSION=3.7.7
      

  • Install Jupyter Notebooks, JupyterLab, and the notebook extensions for RStudio Server Pro and RStudio Connect:

    Terminal
    $ sudo /opt/python/${PYTHON_VERSION}/bin/pip install jupyter jupyterlab rsp_jupyter rsconnect_jupyter
    

  • Install and enable the Jupyter Notebook extensions:

    Terminal
    $ sudo /opt/python/${PYTHON_VERSION}/bin/jupyter-nbextension install --sys-prefix --py rsp_jupyter
    $ sudo /opt/python/${PYTHON_VERSION}/bin/jupyter-nbextension enable --sys-prefix --py rsp_jupyter
    $ sudo /opt/python/${PYTHON_VERSION}/bin/jupyter-nbextension install --sys-prefix --py rsconnect_jupyter
    $ sudo /opt/python/${PYTHON_VERSION}/bin/jupyter-nbextension enable --sys-prefix --py rsconnect_jupyter
    $ sudo /opt/python/${PYTHON_VERSION}/bin/jupyter-serverextension enable --sys-prefix --py rsconnect_jupyter
    

  • (Optional) Install supplemental Python packages:

    Terminal
    $ sudo /opt/python/${PYTHON_VERSION}/bin/pip install altair beautifulsoup4 \
      cloudpickle cython dask gensim keras matplotlib nltk numpy pandas pillow \
      pyarrow requests scipy scikit-image scikit-learn scrapy seaborn spacy \
      sqlalchemy statsmodels tensorflow xgboost
    

Step 3. Configure Launcher with Jupyter Notebooks#

  • Add the following lines to the Launcher Jupyter configuration file:

    File: /etc/rstudio/jupyter.conf
    jupyter-exe=/opt/python/3.7.7/bin/jupyter
    notebooks-enabled=1
    labs-enabled=1
    default-session-cluster=Local
    

  • If you installed a version other than Python 3.7.7, then you can replace 3.7.7 in the above jupyter-exe setting with the the version of Python that you installed.

Step 4. Restart RStudio Server Pro and Launcher Services#

  • Restart the services:

    Terminal
    $ sudo rstudio-server restart
    $ sudo rstudio-launcher restart
    

Step 5. Test RStudio Server Pro with Launcher and Jupyter Notebooks#

  • From your browser, navigate to the RStudio Server Pro interface and log in.
  • Select New Session and do the following:

  1. Give your session a name.
  2. In the Editor field, Select either Jupyter Notebooks or JupyterLab as the IDE.
  3. Click Start Session.

A screenshot of the Jupyter Notebook Local Plugin UI that displays the New Session configuration panel and the new session's Editor configured using the Jupyter Notebook option.

Now, you can use the Jupyter Notebooks or JupyterLab interfaces.

(Optional) Configure multiple Python versions or environments#

The Python integration steps described above result in a single Python environment that contains both core packages for Jupyter Notebooks as well as Python packages for end users.

While this is a simple approach, this setup can result in issues if end users want to use different versions of the same package or if some packages conflict with core packages for Jupyter Notebooks.

If you would like to use multiple versions of Python or different Python environments, or if you want to install Jupyter Notebook in a separate environment from Python packages for end users, then you can refer to the documentation for using multiple Python versions and environments with Jupyter.

Troubleshooting RStudio Server Pro and Jupyter#

Refer to the support article on troubleshooting Jupyter Notebooks in RStudio Server Pro for additional information on troubleshooting RStudio Server Pro with Jupyter.

Additional Documentation#

For more information on RStudio Server Pro and Launcher, refer to the following reference documentation: