I have several large shiny apps which perfectly work on my local computer, but do not on my shiny server as it seems impossible to load most of the installed packages.
I work with the package renv
since I want to avoid dependency problems between the packages used in the different shiny apps. So all my nessecary packages are contained within a folder renv
from which I want to load them to run my app:
Minimal working example:
# change path to library
.libPaths("/home/yvs/ShinyApps/test2/renv/library/R-3.6/x86_64-w64-mingw32")
# load packages
library(shiny)
library(DBI)
library(RPostgreSQL)
library(shinyalert)
# run app
shinyApp(
ui = fluidPage(
column(4,
numericInput("x", "Value", 5),
br(),
actionButton("button", "test"),
br(),
textOutput("text")
),
column(8,
tableOutput("table")),
useShinyalert()
),
server = function(input, output) {
observeEvent(input$button, {
cat("Showing", input$x, "rows\n")
shinyalert("yeah!")
})
df <- eventReactive(input$button, {
head(cars, input$x)
})
output$table <- renderTable({
df()
})
output$text <- renderText(
paste0(.libPaths()) # display path to library
)
}
)
This error message appears in my log-file when I call the corresponding http-page:
Fehler: package or namespace load failed for ‘RPostgreSQL’ in library.dynam(lib, package, package.lib):
shared object ‘RPostgreSQL.so’ not found
Ausführung angehalten
When I mark library(RPostgreSQL)
as comment, I can run the app with no error.
Since all packages shiny
, DBI
, RPostgreSQL
and shinyalert
are only available within my renv-folder (and not within the default shiny library), I assume that loading packages via the command .libPaths()
seems to work. Thus, I don't think it is only a permission problem (I do not owe admin rights or the permission to run/log in as user shiny.
Moreover I do not think that this problem is limited to the package RPostgreSQL
as I attempted to load many different packages.
It worked with the following packages:
shiny
leaflet
stats
utils
graphics
DBI
shinycssloaders
shinyalert
shinyjs
DT
.
It did not work with the following packages:
sp
plotly
RPostgreSQL
postGIStools
dplyr
lubridate
devtools
rCharts
rjson
yaml
config
.
I am aware of at least the following two similar issues:
However, neither of them helped to solve my problems.
Both my local computer and the shiny server use R 3.6.3.
Any help much appreciated!