Problem when deploying Shiny / dependencies

Hi! I'm new at shiny. I'm trying to deploy my first App. It worwed perfectly on my computer (using R studio). But when depploying there seems to be a strange problem with dependencies. Particularly, the deployed app shows the following error message

An error has occurred

The application failed to start: exited unexpectedly with code 1

Error in value[[3L]](cond) : there is no package called ‘tidyverse’ Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Ejecución interrumpida

I believe you can see it here: https://cvfh.shinyapps.io/shiny_debates_latamv3/

My app.R goes like this:

# packages
library(shiny)
library(tidyverse)
library(amap)
library(RColorBrewer)
library(plotly)
library(bslib)
library(dendextend)

# data
base <- read.csv("data/xxxx.csv", stringsAsFactors = F)
.....

# UI
ui <- navbarPage(
....

# SERVER
server <- function(input, output) { ...

All data is referred to a relative folder.

I had and reinstalled tidyverse , the R version, R studio, and de problem persists.
Any clue or help? I couldn't be more thankful

Have you installed the tidyverse package in your R?

Could you check what your app's logs say? Maybe we can find more details there.

Hi! this is what is says (it is repeated several times sinces I tryed to deploy more than once)

2021-09-04T12:51:20.453965+00:00 shinyapps[4583654]: Running on host: e4a88be07495
2021-09-04T12:51:20.459384+00:00 shinyapps[4583654]: Server version: 1.8.6.1
2021-09-04T12:51:20.459403+00:00 shinyapps[4583654]: R version: 4.1.1
2021-09-04T12:51:20.459402+00:00 shinyapps[4583654]: LANG: es_AR.UTF-8
2021-09-04T12:51:20.459403+00:00 shinyapps[4583654]: shiny version: 1.6.0
2021-09-04T12:51:20.459437+00:00 shinyapps[4583654]: rmarkdown version: (none)
2021-09-04T12:51:20.459422+00:00 shinyapps[4583654]: httpuv version: 1.6.2
2021-09-04T12:51:20.459496+00:00 shinyapps[4583654]: knitr version: (none)
2021-09-04T12:51:20.459506+00:00 shinyapps[4583654]: jsonlite version: 1.7.2
2021-09-04T12:51:20.459507+00:00 shinyapps[4583654]: htmltools version: 0.5.2
2021-09-04T12:51:20.459507+00:00 shinyapps[4583654]: RJSONIO version: (none)
2021-09-04T12:51:20.459643+00:00 shinyapps[4583654]: Using pandoc: /opt/connect/ext/pandoc/2.11
2021-09-04T12:51:20.640103+00:00 shinyapps[4583654]: Using jsonlite for JSON processing
2021-09-04T12:51:20.643591+00:00 shinyapps[4583654]:
2021-09-04T12:51:20.643593+00:00 shinyapps[4583654]: Starting R with process ID: '41'
2021-09-04T12:51:20.674632+00:00 shinyapps[4583654]: Error in value[3L] : there is no package called ‘tidyverse’
2021-09-04T12:51:20.674633+00:00 shinyapps[4583654]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2021-09-04T12:51:20.674647+00:00 shinyapps[4583654]: Ejecución interrumpida

yes! and re-installed it. and reinstalled devtools and reinstalled it again. It works perfectly on my pc

There is nothing evident there to me, maybe if we take a look at the actual code? Also, have you tried deleting the existing app and redeploying (so any cached data is cleared)? Some times when there is a package update in CRAN the RStudio's package Manager takes a couple days to catch up with the precompiled binaries for it.

yes, I deleted it and redeployed. I also created a new whole copy of the project and still get the same error message.

Here you can see the original code:
https://github.com/CVFH/shiny_debates_latamv3/blob/master/app.R

I also tried deploying the demo app modified to use tidyverse: that worked !!

I tried deploying my app with only tidyverse and muting functionalities related to more specific packages , but didn't work.

I'm now quite convinced it is another dependency problem (i.e: with my data) . Could it be that the error message is misleading?

in any case: thank you for your help

This is very weird, another thing to try is to clear your deployment cache

Also, can you post the console output you get when you deploy the app? I'm trying to find any clue that could lead us in the right direction.

This is the console output:

Preparing to deploy application...
Update application currently deployed at
https://cvfh.shinyapps.io/shiny_debates_latamv3/? [Y/n] y
DONE
Uploading bundle for application: 4583654...DONE
Deploying bundle: 5000160 for application: 4583654 ...
Waiting for task: 1003572354
building: Processing bundle: 5000160
building: Building image: 5729733
building: Installing packages
building: Installing files
building: Pushing image: 5729733
deploying: Starting instances
rollforward: Activating new instances
unstaging: Stopping old instances
Application successfully deployed to https://cvfh.shinyapps.io/shiny_debates_latamv3/
Warning message:
In fileDependencies.R(file) :
Failed to parse C:/Users/carof/AppData/Local/Temp/RtmpucBObq/file330c1b287cf9/app.R ; dependencies in this file will not be discovered.

I'll try what you suggest. thou I'm now definetively convinced there's a problem with the uploading / using of the files. In the demo I tried, I had no problem with tidyverse nor with introducing a first database. But when I try to use any second database, parsing fails. What should I do to manage more than one database?

(this is the code I'm experimenting with. I'm "#" each data line at a time:)

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)
library(tidyverse)

data <- read.csv("base.csv", stringsAsFactors = F)
#base_años <-  read.csv("base_anos.csv", stringsAsFactors = F)
#base_organizadores <- read.csv("base_organizadores.csv", stringsAsFactors = F)
#base_formatos <- read.csv("base_formatos.csv", stringsAsFactors = F)
#base_temas <- read.csv("base_temas.csv", stringsAsFactors = F)
#base_normativa <- read.csv("base_normativa.csv", stringsAsFactors = F)
codebook <-  read.csv("codebook.csv", stringsAsFactors = F)
#base_cluster_pais <- read.csv("base_cluster_pais.csv", stringsAsFactors = F)
#codebook_cluster_pais <-  read.csv("codebook_cluster_pais.csv", stringsAsFactors = F)


# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
        sidebarPanel(
            sliderInput("bins",
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)
        ),

        # Show a plot of the generated distribution
        mainPanel(
           plotOutput("distPlot"),
           tableOutput("disttable")
        )
    )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- data
        binsi <- input$binsrsc

        # draw the histogram with the specified number of bins
        x %>% 
            ggplot() +
            geom_histogram(aes(n_ausentes), 
                           bins = binsi)
    })
    
    output$disttable <- renderTable({
        codebook
    })
    
}

# Run the application 
shinyApp(ui = ui, server = server)

This suggests an encoding issue, maybe because of non-ASCII characters in your file (e. g. Spanish accents).

This sort of problem happens very often with shinyapps.io, one thing to try is setting options(encoding = "UTF-8") before deploying the app. If that doesn't work, try copying your code into a new file explicitly encoded as UTF8 from the beginning.

ok!!! thank you very much, that is an interesting clue :star_struck:

It worked! there were a few databases with strange characters (ie: accents and "ñ") inside colnames. I had to rename them manually . thank you very much again!

Glad to be of service!

Just a small advice, do not refer to csv files as databases because it can't create confution, some people might assume you are talking about a database engine (e.g. Postgresql, MySQL, Microsoft SQL, etc) and not just a simple csv file.

Also, If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

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.