I've built an app with Shiny which uses machine learning to perform a semantic search on a collection of documents. The app uses reticulate to access the huggingface sentence-transformers library. The app works fine locally, but when trying to send it to shiny.io I consistently get the same error of:
Warning: The reticulate package is installed but no Python environment is available.
Did you forget to set the RETICULATE_PYTHON environment variable in your .Rprofile before publishing?
I followed the instructions in this tutorial of how to correctly write the .Rprofile file, but still no luck. I have also tried to create the virtual environment as it is being deployed to shinyio as below, but I ran out of RAM to install the packages needed.
reticulate::virtualenv_create(envname='my_env', python = 'usr/bin/python3')
reticulate::virtualenv_install('my_env', packages=c('numpy', 'pandas', 'sentence-transformers', 'faiss-cpu'))
I am working in a windows environment, and when initially creating the virtual environment with reticulate, I had to vary my command to be:
my_env/Scripts/python.exe
(in contrast, most tutorials stated that the command is my_env/bin/python)
Currently, my .Rrofile is as below, but I have tried a wide variety of different things. Is this an issue with windows? Or is there a fix?
if (Sys.info()[['user']] == 'shiny'){
Sys.setenv(RETICULATE_PYTHON='home/shiny/.virtualenvs/my_env/Scripts/python')
} else {
Sys.setenv(RETICULATE_PYTHON='my_env/Scripts/python.exe')
}