简体   繁体   中英

Shiny server preloads packages?

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?

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM