Site icon R-bloggers

RStudio Connect Python Minimum Version Update

[This article was first published on RStudio | Open source & professional software for data science teams on RStudio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

What Administrators and Publishers should know

The March 2022 RStudio Connect release removes support for Python 2 and updates the minimum version supported to Python 3.5.

Why now?

Python 2.7 has reached end of life (EOL) maintenance status. On January 1, 2020, the Python language governing body ended support for this version, and they are no longer providing security patches. RStudio Connect continued to support Python 2.7 beyond its EOL status announcement, but several factors have influenced our decision to end support:

How does this affect my Connect installation and published content using an older version of Python?

The March 2022 release of RStudio Connect introduces a breaking change for installations and content that use a Python version below 3.5.

What action needs to be taken?

Connect Administrators need to remove older versions of Python from the Connect installation. Publishers need to update their deployed content to use Python version 3.5 or higher.

Update the Connect configuration file

In order to upgrade RStudio Connect, verify that your configuration file does not include Python 2 or Python 3 versions prior to 3.5. If it does, and you do not remove those configuration settings, the Connect service will throw an error during start-up. This is a breaking change.

The configuration file should only contain Python 3 versions that meet the minimum requirements (Example):

; /etc/rstudio-connect/rstudio-connect.gcfg
[Python]
Enabled = true
Executable = /shared/Python/3.7.6/bin/python3
Executable = /shared/Python/3.8.1/bin/python3

In addition to the new minimum version requirements, Python installations no longer require the virtualenv package to be installed. Python content will now use the venv module included with Python 3.

Note: RStudio Workbench does not document minimum version requirements for Python, but you may want to schedule time to check or update the versions available there as well to avoid publishing errors due to environment mismatches.

Update content that uses an older version of Python

Content owners need to update their code to use Python version 3.5 or higher. Content can be re-published to the same location, preserving existing settings like custom URLs, environment variables, access permissions, or runtime settings.

If published apps or APIs using an older version of Python are not updated, they will fail to run. Static R Markdown reports and Jupyter Notebooks using an older version of Python can still be viewed, but they will fail to re-render. Scheduled reports will send error message emails.

How can you identify content that will break?

Conduct a Python runtime audit of your server and the deployed content. This video overview provides tips for auditing Python usage on RStudio Connect depending on the level of detail you need.

Upgrade RStudio Connect

Before upgrading, please review the full release notes.

Upgrading RStudio Connect typically requires less than five minutes. This release contains a breaking change which may require an update to the Connect configuration file.

The rstudio-connect service will fail to start if the configuration file includes Python 2 or Python 3 versions prior to 3.5. Edit the configuration to remove any Python.Executable properties that do not meet the new minimum version requirements.

If you are upgrading from a version earlier than the February 2022 edition, be sure to consult the release notes for the intermediate releases, as well:

To perform an RStudio Connect upgrade, download and run the installation script. The script installs a new version of Connect on top of the earlier one. Existing configuration settings are respected.

# Download the installation script
curl -Lo rsc-installer.sh https://cdn.rstudio.com/connect/installer/installer-v1.10.0.sh

# Run the installation script
sudo -E bash ./rsc-installer.sh 2022.03.2

Standard upgrade documentation can be found here.

Sign up for RStudio Professional Product Updates

To leave a comment for the author, please follow the link and comment on their blog: RStudio | Open source & professional software for data science teams on RStudio.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.