Troubles with package loading in shiny app deployment

Hi,

I have a problem when I try to deploy my shiny app online (while it work perfectly locally).
It seems the access to installed packages is not working.

Please find below the outputs needed to understand my problem.

Thank you for your help!!!

Martin

(i) the output of the application logs:

2019-07-10T07:17:28.289421+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:28.283152+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:28.289422+00:00 shinyapps[1008632]: there is no package called ‘shinyWidgets’
2019-07-10T07:17:28.296409+00:00 shinyapps[1008632]: Error in value[3L] : could not find function "read.xlsx"
**2019-07-10T07:17:28.296410+00:00 shinyapps[1008632]: Calls: local ... **
2019-07-10T07:17:28.289108+00:00 shinyapps[1008632]: Loading required package: shinyWidgets
2019-07-10T07:17:28.296412+00:00 shinyapps[1008632]: Execution halted
2019-07-10T07:17:34.751259+00:00 shinyapps[1008632]: Server version: 1.7.6-6
2019-07-10T07:17:34.751298+00:00 shinyapps[1008632]: LANG: en_US.UTF-8
2019-07-10T07:17:34.751300+00:00 shinyapps[1008632]: R version: 3.6.0
2019-07-10T07:17:34.751319+00:00 shinyapps[1008632]: shiny version: 1.3.2
2019-07-10T07:17:34.751322+00:00 shinyapps[1008632]: httpuv version: 1.5.1
2019-07-10T07:17:34.751339+00:00 shinyapps[1008632]: rmarkdown version: (none)
2019-07-10T07:17:34.751342+00:00 shinyapps[1008632]: knitr version: (none)
**2019-07-10T07:17:34.751569+00:00 shinyapps[1008632]: Using pandoc at **
2019-07-10T07:17:35.000983+00:00 shinyapps[1008632]: Using jsonlite for JSON processing
2019-07-10T07:17:34.751360+00:00 shinyapps[1008632]: jsonlite version: 1.6
2019-07-10T07:17:34.751392+00:00 shinyapps[1008632]: htmltools version: 0.3.6
2019-07-10T07:17:34.751379+00:00 shinyapps[1008632]: RJSONIO version: (none)
**2019-07-10T07:17:35.007913+00:00 shinyapps[1008632]: **
2019-07-10T07:17:35.055755+00:00 shinyapps[1008632]: there is no package called ‘readtext’
2019-07-10T07:17:35.053836+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.056293+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.053838+00:00 shinyapps[1008632]: there is no package called ‘ggplot2’
2019-07-10T07:17:35.056295+00:00 shinyapps[1008632]: there is no package called ‘openxlsx’
2019-07-10T07:17:35.053231+00:00 shinyapps[1008632]: Loading required package: ggplot2
2019-07-10T07:17:35.055955+00:00 shinyapps[1008632]: Loading required package: openxlsx
2019-07-10T07:17:35.054041+00:00 shinyapps[1008632]: Loading required package: scales
2019-07-10T07:17:35.056487+00:00 shinyapps[1008632]: Loading required package: dplyr
2019-07-10T07:17:35.054392+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.056830+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.054393+00:00 shinyapps[1008632]: there is no package called ‘scales’
2019-07-10T07:17:35.056832+00:00 shinyapps[1008632]: there is no package called ‘dplyr’
2019-07-10T07:17:35.055408+00:00 shinyapps[1008632]: Loading required package: readtext
2019-07-10T07:17:35.057027+00:00 shinyapps[1008632]: Loading required package: leaflet
2019-07-10T07:17:35.055754+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.057368+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.007915+00:00 shinyapps[1008632]: Starting R with process ID: '42'
2019-07-10T07:17:35.057369+00:00 shinyapps[1008632]: there is no package called ‘leaflet’
2019-07-10T07:17:35.062109+00:00 shinyapps[1008632]: Loading required package: rsconnect
2019-07-10T07:17:35.062572+00:00 shinyapps[1008632]: there is no package called ‘rsconnect’
2019-07-10T07:17:35.062570+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.062774+00:00 shinyapps[1008632]: Loading required package: export
2019-07-10T07:17:35.063101+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.063127+00:00 shinyapps[1008632]: there is no package called ‘export’
2019-07-10T07:17:35.063326+00:00 shinyapps[1008632]: Loading required package: shinyWidgets
2019-07-10T07:17:35.063667+00:00 shinyapps[1008632]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2019-07-10T07:17:35.063668+00:00 shinyapps[1008632]: there is no package called ‘shinyWidgets’
2019-07-10T07:17:35.070694+00:00 shinyapps[1008632]: Execution halted
2019-07-10T07:17:35.070692+00:00 shinyapps[1008632]: Error in value[3L] : could not find function "read.xlsx"
**2019-07-10T07:17:35.070693+00:00 shinyapps[1008632]: Calls: local ...

(iv) output of "rsconnect::appDependencies()"

 **package  version source**

1 BH 1.69.0-1 CRAN
2 R6 2.4.0 CRAN
3 Rcpp 1.0.1 CRAN
4 crayon 1.3.4 CRAN
5 digest 0.6.19 CRAN
6 htmltools 0.3.6 CRAN
7 httpuv 1.5.1 CRAN
8 jsonlite 1.6 CRAN
9 later 0.8.0 CRAN
10 magrittr 1.5 CRAN
11 mime 0.7 CRAN
12 promises 1.0.1 CRAN
13 rlang 0.4.0 CRAN
14 shiny 1.3.2 CRAN
15 sourcetools 0.1.7 CRAN
16 xtable 1.8-4 CRAN

Can you show how you write library() in your code ?

I had a similar problem when I deployed my first app but I realized it was because I called packages with library("readxl") (for example) instead of library(readxl). Maybe you did the same mistake

Both library("readxl") and library(readxl) should work unless there is something specific in shiny of which I am unaware.

Well, I can't explain it, I just remember that I had this sort of problem and removing the quotation marks worked.

I had posted it on StackOverflow : https://stackoverflow.com/questions/56569603/shinyapps-io-packages-are-not-loaded

Ah, your SO link shows you specified character.only = TRUE. This changes the default behaviour of the library call. In this case you need to include the quotes.

Check ?library for the definitions.

Okay, thank you for the information (I didn't specify character.only = TRUE, it did automatically).

The code here also has character.only = TRUE, so maybe quotation marks have to be removed from his original code if he wrote them

I use both ways to load packages I need but the same error occured...
I have administrator rights, so I do not understand why "no library trees found in 'lib.loc'".

Thak you for your help!

Martin

Ah, something new when I try to display fileDependencies for my app:

Warning messages:
1: In fileDependencies.R(file) :
** Failed to parse C:/Users/m.lechenet/AppData/Local/Temp/RtmpQtCUiE/file3b84be438b3/app.r ; dependencies in this file will not be discovered.**
2: In FUN(X[[i]], ...) :
** Failed to infer source for package 'sourcetools'; using latest available version on CRAN instead**
3: In FUN(X[[i]], ...) :
** Failed to infer source for package 'BH'; using latest available version on CRAN instead**
4: In FUN(X[[i]], ...) :
** Failed to infer source for package 'BH'; using latest available version on CRAN instead**
5: In FUN(X[[i]], ...) :
** Failed to infer source for package 'BH'; using latest available version on CRAN instead**
6: In FUN(X[[i]], ...) :
** Failed to infer source for package 'BH'; using latest available version on CRAN instead**
7: In FUN(X[[i]], ...) :
** Failed to infer source for package 'BH'; using latest available version on CRAN instead**
8: Unable to package DESCRIPTION files: Couldn't find DESCRIPTION file for BH