Unable to unload `Rcpp` version 0.12.12


#1

I currently host several shiny apps on a in-house server running the open source versions of RStudio server and shiny server. I am not the admin of the server and only have rights to my personal user folder. I am running into an issue with how packages are loaded via namespace by other packages.

For some background, this all started after I updated an internal package that my apps depend on that required that the newest version of the tidyverse be installed. The server admin does not want to update the packages on the system library because it may effect other users, so I had to install them all into my user library. For some reason, my user name on the server can not get past my companies proxy, so I am forced to upload the .tar.gz files from CRAN and then install the packages via the command line.

This was working well and I updated all the packages that are required. However, I am running into an issue with namespace. The system library currently has Rcpp 0.12.12 installed, while my user library has Rcpp 0.12.15 installed. When I launch the app from the RStudio server IDE, it runs with no problems. However, when I try and launch the app directly from the server (i.e, from the server url) I get an error. This is what is in the log files:

Error in value[[3L]](cond) :
  Package ‘Rcpp’ version 0.12.12 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘Rcpp’ is imported by ‘httpuv’, ‘htmltools’ so cannot be unloaded
Calls: runApp ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Here are the packages that are loaded in my global.R file:

loc <- "/home/tylerbradley/R/x86_64-pc-linux-gnu-library/3.4"
suppressPackageStartupMessages({
  library(Rcpp, lib.loc = loc)
  library(htmltools, lib.loc = loc)
  library(httpuv, lib.loc = loc)
  library(shiny, lib.loc = loc)
  library(magrittr, lib.loc = loc)
  library(DT, lib.loc = loc)
  library(shinyjs, lib.loc = loc)
  library(wqr, lib.loc = loc)
  # library(dplyr, lib.loc = loc)
  # library(tidyr, lib.loc = loc)
  # library(ggplot2, lib.loc = loc)
  library(lubridate, lib.loc = loc)
  library(ggsci, lib.loc = loc)
  library(shinydashboard, lib.loc = loc)
  library(srarr, lib.loc = loc)
  library(PerformanceAnalytics, lib.loc = loc)
  library(tidyverse, lib.loc = loc)
  library(tidyquant, lib.loc = loc)
  library(surveillance, lib.loc = loc)
  library(plotly, lib.loc = loc)
})

I have tried moving around the order that they are called, but this has not worked. I have installed all non base-R packages into my user library and explicitly defined my user library location to load packages from, so that it has as little dependency on it as possible. Does anyone have any suggestions on what could be going wrong?

The server is running R version 3.4.3


#2

Have you tried using packrat to resolve your package requirements?

See Deploying packrat projects to Shiny Server Pro for instructions.