Problem deploying app. Using a virtual env with reticulate to run python code in app. Error — virtual environment: permission denied

I tried using virtualenv_install() instead of py_install() and now it works! Thank you both so much for your help @andresrcs and @Yarnabrina!

If others come across this with the same problem, here is the relevant code to set up the python virtual environment to be able to deploy to shinyapps.io:

virtualenv_create(envname = "python_environment", python= "python3")
virtualenv_install("python_environment", packages = c('keras', 'pandas','numpy','scipy','scikit-learn', 'tensorflow'))
reticulate::use_virtualenv("python_environment", required = TRUE)

For clarity, the specific packages are just what my python code needed.

Also, you may need to run (and then comment out for deployment) the following line to use an older version of rsconnect if you get an error that says: reticulate is in use, but python was not specified

devtools::install_github("rstudio/rsconnect", ref='737cd48')
1 Like