Integrating RStudio Server Pro with Python

These instructions describe how to install and integrate Python and reticulate with RStudio Server Pro.

Once you configure Python and reticulate with RStudio Server Pro, users will be able to develop mixed R and Python content with Shiny apps, R Markdown reports, and Plumber APIs that call out to Python code using the reticulate package.

1. Install Python for all users

Install Python on the server with RStudio Server Pro in a central location for all users (e.g., /opt/python/3.7.6/).

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.

2. Install reticulate for all users

Install the reticulate R package for all users in the global R library. For example, if R is installed in /opt/R/3.7.6/, then you you can use the following command:

Terminal

$ sudo /opt/R/3.7.6/bin/Rscript -e 'install.packages("reticulate")'

3. Configure reticulate with Python for all users

Set the RETICULATE_PYTHON environment variable for all RStudio Server Pro users by putting the following line in the R session-specific profile script used by RStudio Server Pro. For example, if Python is installed in /opt/python/3.7.6/, then you you can use the following configuration:

File: /etc/rstudio/rsession-profile

export RETICULATE_PYTHON=/opt/python/3.7.6/bin/python

Additional Information

For more information on end-users working with custom, per-project Python environments, refer to the support article on Installing and Configuring Python with RStudio.