I've encountered some odd behavior in RStudio Connect while deploying a Plumber API with Reticulate.
I have a piece of equipment that performs a CURL POST command to upload a file to my Plumber API. The API copies the file locally and runs a Python script against it using Reticulate. In the Plumber API, I am building the Python Virtual Env in the code which I suspect is the root of the issue. These are the types of functions I am calling in Plumber:
- virtualenv_create
- virtualenv_install
- py_run_string
- py_run_file
The code executes successfully when it is called only once or twice. The problem occurs when I have a lot of files I am trying to send. The files are successfully sent to the API and copied but the Python script fails. This is the type of error I am seeing in the logs:
<Rcpp::exception in py_run_file_impl(file, local, convert): Unable to open file 'script.py' (does it exist?)
An error occurred: render-python-code-error
Possible causes: There is a bug in the Python code being deployed.
I'm wondering if somehow RStudio Connect is choking on multiple calls the virtual environment that is created. Anyone have any ideas on what's going on here or how to debug this?