Integrating Posit Connect with Python#
RStudio is now Posit!
Our professional products have been renamed to Posit Connect, Posit Workbench, Posit Package Manager, Posit Cloud, and Posit Academy so it’s easier for folks to understand that we support more than just R. Please review our Blog post/FAQ to answer commonly asked questions about the rebrand.
These instructions describe how to install and integrate Python with Posit Connect, formerly RStudio Connect.
Once you configure Python with Connect, users can publish the following content:
- Jupyter Notebooks
- Flask applications
- FastAPI applications
- Plotly Dash applications
- Streamlit applications
- Bokeh applications
- Shiny applications
- Mixed R and Python content using the reticulate package
Step 1. Install Python#
Note
The minimum Python version supported by Connect is now 3.5. Configuration files that include Python 2, or Python 3 versions prior to 3.5, will cause an error during Connect startup.
-
Install Python on the Connect server following the documented 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. Configure Python in Connect#
-
Enable Python in Connect by adding a
[Python]
section to the Connect configuration file. This section should contain anExecutable
option that refers to the location of the Python executable.For example, if you installed Python 3.7.13 on the Connect server, then your configuration file would appear as:
File: /etc/rstudio-connect/rstudio-connect.gcfg[Python] Enabled = true Executable = /opt/python/3.7.13/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 Connect configuration file with the
Executable
option for each additional version of Python that you installed.For example, if you installed Python 3.6.5, 3.8.9 and 3.7.13 on the Connect server, then your configuration file would appear as:
File: /etc/rstudio-connect/rstudio-connect.gcfg[Python] Enabled = true Executable = /opt/python/3.8.9/bin/python Executable = /opt/python/3.6.5/bin/python Executable = /opt/python/3.7.13/bin/python
Additional Information#
For more information on best practices for end users when working with Python and Connect, refer to the support article on Best Practices for using Python with Connect.