0

I have a shiny app that requires python code. Source_python works fine when I call it from RStudio, but when I run the shiny app (sourcing the python file from within app.R), the python code is not available.

I am using a virtual python environment with all dependencies installed. I called py_config() from RStudio as well as from within the shiny app, and the output was identical.

Any idea why this is still not working?

Yuki Weber
  • 21
  • 1
  • 4

1 Answers1

1

I moved the source_python call into an R script, and sourced that R script in app.R.

app.R:
library(shiny)
library(reticulate)
source("FUNS.R")

FUNS.R:
reticulate::source_python("ABC.py")

Now the app runs fine on RStudio Server and also when deployed to a remote Shiny Server.

Yuki Weber
  • 21
  • 1
  • 4