Packages Missing in Shiny-Server

Packages missing in shiny-server

Compare the output of .libPaths() in both cases and adjust accordingly in the server instance / your script.

You may for example have the packages in "your" R package directory which the server cannot access. System-wide package installations are preferable in cases like this -- and are e.g. the default on Debian / Ubuntu.

R shiny / shiny-server - issue with finding packages

Sorry for the troubles. Can you try running the following command to install Shiny system-wide?

sudo su - \
-c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""

This comes from the Admin Guide which (hopefully) will serve as a useful resource on these kinds of issues.

I suspect that the problem is that Shiny is indeed properly installed in your user account, but because it wasn't installed as sudo, it's not available to the shiny user.

Edits:

You'll also need to make sure that Rprofile.site is being applied when the shiny user starts an R process. You can do this by logging in as shiny:

sudo su shiny

Then opening R and checking the .libPaths() or seeing if you can successfully run library(shiny) there. If you're not able to, there's probably an issue with letting the shiny user get into your shared packages directory or your Rprofile.site file (or its parent directory). Ensure that the shiny user is added to the necessary groups or that these files and all of their parent directories grant the appropriate permissions to the shiny user.

How to use renv package in shiny app to avoid installing new packages on shiny server?

https://community.rstudio.com/t/shiny-server-renv/71879/2 may be relevant -- you likely want to call renv::isolate() before copying your project folder.

Shiny server preloads packages?

As suggested by user2554330 in the comments, I looked for the R_LIBS option and found this article that pointed me to configuring Shiny Server (works only in the Pro version) to run this specific app with its local packages, overriding the global package library. This has fixed my problem.

  location /AinA-mvp2 {
run_as shiny;
site_dir /srv/shiny-server/localarea36;
log_dir /mnt/logs/Test/localarea36;
log_file_mode 0644;
exec_supervisor "R_LIBS_USER=/srv/shiny-server/localarea36/library"


Related Topics



Leave a reply



Submit