Shinny App deployment success but failed to load online.

I am very new to Shinny. In fact, it is my first time work with R and shinny, do forgive me if I asked something stupid.

I deploy it successfully, but the app fail to load at all.. so I checked the log seems it could not find the package such as doParallel doRNG. and function detectCores(). These packages and functions I have been using locally without a problem. Did I do anything wrong?

here is how i load my packages

REMOTE <- TRUE

bioc_packages <- c(
    "PharmacoGx", "annotate",
    "org.Hs.eg.db", "survcomp"
)

carn_packages <- c(
    "BiocManager", "apcluster", "rcdk", "fingerprint",
    "SNFtool", "ROCR", "reshape2", "log4r", "docstring",
    "proxy", "pheatmap", "GSA", "foreach", "tools", "tidyverse",
    "doParallel", "doRNG", "shiny", "shinycssloaders", "parallel"
)

if (!REMOTE) {
    carn_packages <- carn_packages[!(carn_packages %in% installed.packages())]
    bioc_packages <- bioc_packages[!(bioc_packages %in% installed.packages())]
    if (length(carn_packages)) install.packages(carn_packages)
    if (length(bioc_packages)) BiocManager::install(bioc_packages)
}

packages <- c(bioc_packages, carn_packages)
for (pkg in packages) {
    print(paste("loading package: ", pkg))
    require(pkg, character.only = TRUE)
}

rm(list = ls())

here is the log

2021-10-15T00:54:23.327989+00:00 shinyapps[4875346]: 
2021-10-15T00:54:23.406709+00:00 shinyapps[4875346]: 
2021-10-15T00:54:23.407019+00:00 shinyapps[4875346]: The following object is masked from β€˜package:utils’:
2021-10-15T00:54:23.407020+00:00 shinyapps[4875346]: 
2021-10-15T00:54:23.407914+00:00 shinyapps[4875346]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
2021-10-15T00:54:23.407950+00:00 shinyapps[4875346]: [1] "loading package:  GSA"
2021-10-15T00:54:23.408074+00:00 shinyapps[4875346]: Loading required package: GSA
2021-10-15T00:54:23.328048+00:00 shinyapps[4875346]: [1] "loading package:  docstring"
2021-10-15T00:54:23.328136+00:00 shinyapps[4875346]: Loading required package: docstring
2021-10-15T00:54:23.406711+00:00 shinyapps[4875346]: 
2021-10-15T00:54:23.407021+00:00 shinyapps[4875346]:     ?
2021-10-15T00:54:23.407078+00:00 shinyapps[4875346]: [1] "loading package:  proxy"
2021-10-15T00:54:23.407214+00:00 shinyapps[4875346]: Loading required package: proxy
2021-10-15T00:54:23.407493+00:00 shinyapps[4875346]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
2021-10-15T00:54:23.407021+00:00 shinyapps[4875346]: 
2021-10-15T00:54:23.407495+00:00 shinyapps[4875346]:   there is no package called β€˜proxy’
2021-10-15T00:54:23.407540+00:00 shinyapps[4875346]: [1] "loading package:  pheatmap"
2021-10-15T00:54:23.407671+00:00 shinyapps[4875346]: Loading required package: pheatmap
2021-10-15T00:54:23.407915+00:00 shinyapps[4875346]:   there is no package called β€˜pheatmap’
2021-10-15T00:54:23.408464+00:00 shinyapps[4875346]: Loading required package: foreach
2021-10-15T00:54:23.408302+00:00 shinyapps[4875346]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
2021-10-15T00:54:23.408348+00:00 shinyapps[4875346]: [1] "loading package:  foreach"
2021-10-15T00:54:23.422671+00:00 shinyapps[4875346]: [1] "loading package:  tools"
2021-10-15T00:54:23.422837+00:00 shinyapps[4875346]: Loading required package: tools
2021-10-15T00:54:23.427099+00:00 shinyapps[4875346]: [1] "loading package:  tidyverse"
2021-10-15T00:54:23.427248+00:00 shinyapps[4875346]: Loading required package: tidyverse
2021-10-15T00:54:24.391092+00:00 shinyapps[4875346]: ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
2021-10-15T00:54:24.396762+00:00 shinyapps[4875346]: βœ” ggplot2 3.3.5     βœ” purrr   0.3.4
2021-10-15T00:54:24.396762+00:00 shinyapps[4875346]: βœ” tibble  3.1.2     βœ” dplyr   1.0.7
2021-10-15T00:54:24.396763+00:00 shinyapps[4875346]: βœ” tidyr   1.1.3     βœ” stringr 1.4.0
2021-10-15T00:54:24.396763+00:00 shinyapps[4875346]: βœ” readr   2.0.2     βœ” forcats 0.5.1
2021-10-15T00:54:24.497869+00:00 shinyapps[4875346]: ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
2021-10-15T00:54:24.497871+00:00 shinyapps[4875346]: βœ– purrr::accumulate() masks foreach::accumulate()
2021-10-15T00:54:24.497872+00:00 shinyapps[4875346]: βœ– dplyr::count()      masks fingerprint::count()
2021-10-15T00:54:24.497873+00:00 shinyapps[4875346]: βœ– dplyr::filter()     masks stats::filter()
2021-10-15T00:54:24.497873+00:00 shinyapps[4875346]: βœ– dplyr::lag()        masks stats::lag()
2021-10-15T00:54:24.497873+00:00 shinyapps[4875346]: βœ– purrr::when()       masks foreach::when()
2021-10-15T00:54:24.501077+00:00 shinyapps[4875346]: Loading required package: doParallel
2021-10-15T00:54:24.500863+00:00 shinyapps[4875346]: [1] "loading package:  doParallel"
2021-10-15T00:54:24.501426+00:00 shinyapps[4875346]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
2021-10-15T00:54:24.501480+00:00 shinyapps[4875346]: [1] "loading package:  doRNG"
2021-10-15T00:54:24.501427+00:00 shinyapps[4875346]:   there is no package called β€˜doParallel’
2021-10-15T00:54:24.501625+00:00 shinyapps[4875346]: Loading required package: doRNG
2021-10-15T00:54:24.501890+00:00 shinyapps[4875346]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
2021-10-15T00:54:24.501891+00:00 shinyapps[4875346]:   there is no package called β€˜doRNG’
2021-10-15T00:54:24.501948+00:00 shinyapps[4875346]: [1] "loading package:  shiny"
2021-10-15T00:54:24.511805+00:00 shinyapps[4875346]: Error in value[[3L]](cond) : could not find function "detectCores"
2021-10-15T00:54:24.502000+00:00 shinyapps[4875346]: [1] "loading package:  shinycssloaders"
2021-10-15T00:54:24.511819+00:00 shinyapps[4875346]: Execution halted
2021-10-15T00:54:24.511807+00:00 shinyapps[4875346]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
2021-10-15T00:54:24.511823+00:00 shinyapps[4875346]: Shiny application exiting ...

When you go to deploy from your local to a server, rsconnect tries to make a deployable payload, including your code, and your library dependecies. It attempts to do this by scanning your code for library/require and then tracking their dependencies. I would guess you have obfuscated this process by doing these things programatically.

My suggestion would be to adopt the use of library(renv) to do your overall package management (I believe renv can track bioconducter packages also. And otherwise load the libraries you need in a conventional explicit way. Hope this helps.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.