Shiny app won't deploy

My app will not deploy to shinyapps.io .

The log seems to show an error with package lme4 (which I didn't know I was using...). When I load this package with library(lme4), I get this:

Loading required package: Matrix
Error in value[[3L]](cond) : 
  Package ‘Matrix’ version 1.3.4 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘Matrix’ is imported by ‘survival’, ‘dr4pl’ so cannot be unloaded
In addition: Warning message:
package ‘lme4’ was built under R version 4.0.5

I definitely am using dr4pl package. Is that the cause of me not being able to deploy? How do I resolve this?

Log and sessionInfo below

Preparing to deploy application...DONE
Uploading bundle for application: 7516299...DONE
Deploying bundle: 6472604 for application: 7516299 ...
Waiting for task: 1244795287
  building: Building image: 7613355
  building: Fetching packages
  building: Building package: rbibutils
  building: Building package: RcppArmadillo
  building: Building package: Rdpack
  building: Building package: conquer
  building: Building package: lme4
################################ Begin Task Log ################################ 
[2022-11-03T19:38:18.045144957+0000] Installing R package: BH (1.75.0-0)




#I SKIPPED SEVERAL "NORMAL" LOOKING LINES HERE
#Otherwise post would be over character limit




* installing to library ‘/opt/R/4.0.2/lib/R/library’
* installing *source* package ‘lme4’ ...
** package ‘lme4’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
external.cpp:412:44: error: ‘PI’ was not declared in this scope
  412 |     static double sqrt2pi = std::sqrt(2. * PI);
      |                                            ^~
make: *** [/opt/R/4.0.2/lib/R/etc/Makeconf:176: external.o] Error 1
ERROR: compilation failed for package ‘lme4’
* removing ‘/opt/R/4.0.2/lib/R/library/lme4’
################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 1244795290 failed: Error building image: Error building lme4 (1.1-26). Build exited with non-zero status: 1
Execution halted

Session Info:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] plotly_4.9.3             abind_1.4-5              reshape2_1.4.4           dr4pl_2.0.0              googlesheets4_1.0.0     
 [6] forcats_0.5.1            stringr_1.4.0            dplyr_1.0.8              purrr_0.3.4              tidyr_1.2.0             
[11] tibble_3.1.6             ggplot2_3.3.5            tidyverse_1.3.1          shinydashboardPlus_2.0.3 shinydashboard_0.7.1    
[16] shiny_1.6.0              readr_1.4.0             

loaded via a namespace (and not attached):
 [1] TH.data_1.0-10    googledrive_2.0.0 colorspace_2.0-1  ellipsis_0.3.2    rio_0.5.26        rsconnect_0.8.28  fs_1.5.2         
 [8] rstudioapi_0.13   listenv_0.8.0     furrr_0.2.2       farver_2.1.0      fansi_0.4.2       mvtnorm_1.1-1     lubridate_1.7.10 
[15] xml2_1.3.2        codetools_0.2-18  splines_4.0.2     cachem_1.0.6      jsonlite_1.8.0    broom_0.8.0       dbplyr_2.1.1     
[22] compiler_4.0.2    httr_1.4.2        drc_3.0-1         backports_1.4.1   assertthat_0.2.1  Matrix_1.3-4      fastmap_1.1.0    
[29] lazyeval_0.2.2    gargle_1.2.0      cli_3.2.0         later_1.3.0       htmltools_0.5.2   tools_4.0.2       gtable_0.3.0     
[36] glue_1.6.2        Rcpp_1.0.8.3      carData_3.0-4     cellranger_1.1.0  jquerylib_0.1.4   vctrs_0.3.8       crosstalk_1.1.1  
[43] globals_0.14.0    rbibutils_2.2.8   openxlsx_4.2.3    rvest_1.0.0       mime_0.12         lifecycle_1.0.1   gtools_3.8.2     
[50] future_1.21.0     MASS_7.3-54       zoo_1.8-9         scales_1.1.1      hms_1.0.0         promises_1.2.0.1  parallel_4.0.2   
[57] sandwich_3.0-0    yaml_2.2.1        curl_4.3.1        sass_0.4.1        stringi_1.5.3     plotrix_3.8-1     zip_2.1.1        
[64] Rdpack_2.4        rlang_1.0.2       pkgconfig_2.0.3   lattice_0.20-41   tensor_1.5        htmlwidgets_1.5.3 labeling_0.4.2   
[71] tidyselect_1.1.2  parallelly_1.25.0 plyr_1.8.6        magrittr_2.0.3    R6_2.5.1          generics_0.1.2    multcomp_1.4-17  
[78] DBI_1.1.1         pillar_1.7.0      haven_2.4.1       foreign_0.8-81    withr_2.5.0       survival_3.2-11   modelr_0.1.8     
[85] crayon_1.5.1      car_3.0-10        utf8_1.2.1        grid_4.0.2        readxl_1.3.1      data.table_1.14.0 reprex_2.0.0     
[92] digest_0.6.29     xtable_1.8-4      httpuv_1.6.5      openssl_2.0.4     munsell_0.5.0     viridisLite_0.4.0 bslib_0.3.1      
[99] askpass_1.1

I observed a similar issue.

I updated the lme4-package,
restarted RStudio
and did not run "options(repos = BiocManager::repositories())" (which I needed before to include some BiocManager packages)
and then suddenly it worked...

1 Like

Thanks. For me I switched my libpaths and re-installed lme4 and it seemed to work.

I'll try this next time if I see that error again.