I am attempting to optimize a R shiny application on shinyapps. The issue arises due to the use of reticulate and 5 python packages that the application needs to function. I have followed the steps outlined in: https://github.com/ranikay/shiny-reticulate-app. However, although I have the application working with this method, it is quite inefficient as the user needs to wait around 90 seconds for the packages to download with:
virtualenv_dir = Sys.getenv('VIRTUALENV_NAME') python_path = Sys.getenv('PYTHON_PATH') # Create virtual env and install dependencies reticulate::virtualenv_create(envname = virtualenv_dir, python = python_path) reticulate::virtualenv_install(virtualenv_dir, packages = PYTHON_DEPENDENCIES, ignore_installed=TRUE) reticulate::use_virtualenv(virtualenv_dir, required = T)
Is there any way to install python packages at the deployment phase of releasing a R shiny application. Ideally a way that includes the use of a requirements.txt file that allows creation of the environment at deployment, similarly to Shiny for Python https://shiny.posit.co/py/docs/deploy.html#create-a-requirements.txt. Any solution that doesn't involve the user waiting for python package installation upon application 'wake-up' would be fantastic.
Any help with this would be greatly appreciated!