0
votes

I am running Shiny Server Pro v1.5.10.990. I want to run an application which is dependent on the Rcpp package version 1.0.1. I install this package into the local app library. The problem is that there is a global package library on the server that holds the Rcpp package in version 1.0.0. The application crashes with the following error:

Package ‘Rcpp’ version 1.0.0 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘Rcpp’ is imported by ‘httpuv’, ‘htmltools’, ‘later’, ‘promises’ so cannot be unloaded
Calls: runApp ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

However, Rcpp is the first package that I load in my code. Is it possible that Shiny server is pre-loading the packages ‘httpuv’, ‘htmltools’, ‘later’, ‘promises’? Are there any ideas how I can unload the Rcpp package and load it from the local library?

1
Are you running the server? If so, you can set environment variable R_LIBS before starting it, and R will use the libraries you specify instead of the default ones.user2554330

1 Answers

0
votes

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"