Integrating RStudio Server Pro with Jupyter Notebooks on a Single Server

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 on a single server.

This integration makes use of the Launcher in RStudio Server Pro to spawn Jupyter Notebook and JupyterLab sessions on a single node without the use of an external resource manager.

Prerequisites

This integration is intended to be performed on top of a base installation of RStudio Server Pro.

1. Configure RStudio Server Pro with Launcher

Add the following lines to the RStudio Server Pro configuration file:

File: /etc/rstudio/rserver.conf

# Launcher Config
launcher-address=127.0.0.1
launcher-port=5559
launcher-sessions-enabled=1
launcher-default-cluster=Local
launcher-sessions-callback-address=http://127.0.0.1:8787

In the launcher-sessions-callback-address setting, you should change the protocol and port if you are using HTTPS or a different port for RStudio Server Pro.

2. Configure Launcher settings and plugins

Add the following lines to the Launcher configuration file:

File: /etc/rstudio/launcher.conf

[server]
address=127.0.0.1
port=5559
server-user=rstudio-server
admin-group=rstudio-server
authorization-enabled=1
thread-pool-size=4
enable-debug-logging=1

[cluster]
name=Local
type=Local

3. Install Python

Install Python, pip, and virtualenv on the server 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.

4. Install Jupyter Notebooks, JupyterLab, and Python packages

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.6.5 with the version of Python that you are using:

Terminal

$ export PYTHON_VERSION=3.6.5

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

5. 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.6.5/bin/jupyter
notebooks-enabled=1
labs-enabled=1
default-session-cluster=Local

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

6. Restart RStudio Server Pro and Launcher Services

Terminal

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

7. Test RStudio Server Pro with Launcher and Jupyter Notebooks

In your browser, navigate to the RStudio Server Pro interface and log in.

Select New Session, choose Jupyter Notebooks or JupyterLab as the IDE, then click the Start Session button.

You can then use the Jupyter Notebooks or JupyterLab interfaces.

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 Jupyter Notebooks, refer to the following reference documentation: