Conversion rules for `rpy2.robjects` appear to be missing

Summary

Hi I am running rpy2 under the hood of a streamlit app and I’m getting the following error:

Conversion rules for `rpy2.robjects` appear to be missing. Those rules are in a Python contextvars.ContextVar. This could be caused by multithreading code not passing context to the thread.

Outside of streamlit the code runs perfectly.

How might I go about fixing this error and getting rpy2 to run using streamlit

Requirements file

Name: streamlit
Version: 1.27.2

Name: rpy2
Version: 3.5.14

Name: python
Version: 3.11.4

Hey @Sharif_Amlani, does downgrading rpy2 to 3.5.1 resolve this issue for you? (potentially related StackOverflow thread)