Managing minimum Python version requirements on Posit Connect

Follow

The minimum version of Python supported in Posit Connect is 3.7.0.

In order to upgrade Posit Connect to any release beyond 2023.01.0, verify that your configuration file does not include Python 2 or Python 3 versions prior to 3.7. If it does, and you do not remove those configuration settings, the Connect service will throw an error during startup. 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.

Old Python 2 virtual environments can be removed using a pattern like: rm -rf /var/lib/rstudio-connect/python-environments/pip/2*

Note: Posit 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.

What will happen to content that uses an older version of Python?

  • Existing R Markdown reports and Jupyter Notebooks that use older Python versions can still be viewed. However, they cannot be re-rendered. Scheduled reports that continue to run will send error message emails.
  • Existing applications and APIs that use older Python versions will no longer run. An HTTP 502 error will be returned for all requests to these applications.
  • Content can be re-published to the same location with Python 3.7+, preserving existing settings like environment variables, access permissions, or runtime settings.

How can you identify all 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.

  • Start by executing the script in /opt/rstudio-connect/scripts/find-python-envs which will list all Python virtual environments and the applications that use them.
  • If you require a more detailed audit, use the RStudio Connect Server API to create a custom report:

Comments