Integrating RStudio Connect with Python
These instructions describe how to install and integrate Python with RStudio Connect.
Once you configure Python with RStudio Connect, users will be able to publish Jupyter Notebooks or mixed R/Python content such as Shiny apps, R Markdown reports, and Plumber APIs that call out to Python code using the reticulate package.
1. Install Python
virtualenv on the RStudio Connect server following
the steps to Install Python.
Ensure that you install
virtualenv in your Python environment by running the
$ sudo /opt/python/3.6.5/bin/pip install virtualenv
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. Configure Python in RStudio Connect
Enable Python in RStudio Connect by adding a
[Python] section to the RStudio
Connect configuration file. This section should contain an
that refers to the location of the Python executable.
For example, if you installed Python 3.6.5 on the RStudio Connect server, then your configuration file would appear as:
[Python] Enabled = true Executable = /opt/python/3.6.5/bin/python
(Optional) Install additional versions of Python
To make additional versions of Python available alongside existing versions, repeat the above steps to install a different version of Python to other locations.
Then, add a new line to the RStudio Connect configuration file with the
Executable option for each additional version of Python that you installed.
For example, if you installed Python 2.7.16, 3.6.5, and 3.7.3 on the RStudio Connect server, then your configuration file would appear as:
[Python] Enabled = true Executable = /opt/python/2.7.16/bin/python Executable = /opt/python/3.6.5/bin/python Executable = /opt/python/3.7.3/bin/python