"Plotly" package not being installed or loaded on app. Warning: Error in library: there is no package called ‘plotly’

I am having an issue with my r shiny app and its deployment to shinyapps.io

It appears that shinyapps.io is either not installing or loading the package "plotly" properly. I am not sure why this is because I can see plotly working on other apps.

I receive the error:
Warning: Error in library: there is no package called ‘plotly’

I tried removing the plotly package and publishing the app and I have the same problem with the DT package:
Warning: Error in library: there is no package called ‘DT’

So I do not think its a problem with Plotly, but rather with the deployment on the shinyapps.io side.

The app code is below.
There is a ui file and a server file


library(shiny)
library(plotly)
library(DT)

# Define UI for application that draws a histogram
shinyUI(fluidPage(

    # Application title
    titlePanel("Robert E. Howard Word Usage Analysis"),
    navbarPage("Pages:",
               #page to view dataset
               tabPanel("Adjectives",
                        #textOutput("text"),
                        DT::dataTableOutput('adjtable'),
                        selectizeInput('var1adj',
                                       'Select word (type to search)',
                                       choices = NULL, 
                                       selected = NULL, 
                                       multiple = FALSE,
                                       options = NULL),
                        plotlyOutput('adjPlot')
               ),
               tabPanel("Hypenated Adjectives",
                        DT::dataTableOutput('hadjtable'),
                        selectizeInput('var1hadj',
                                       'Select word (type to search)',
                                       choices = NULL, 
                                       selected = NULL, 
                                       multiple = FALSE,
                                       options = NULL),
                        plotlyOutput('hadjPlot')
                ),
               tabPanel("Verbs",
                        DT::dataTableOutput('vrbtable'),
                        selectizeInput('var1vrb',
                                       'Select word (type to search)',
                                       choices = NULL, 
                                       selected = NULL, 
                                       multiple = FALSE,
                                       options = NULL),
                        plotlyOutput('vrbPlot')
               ),
               tabPanel("Nouns",
                        DT::dataTableOutput('nntable'),
                        selectizeInput('var1nn',
                                       'Select word (type to search)',
                                       choices = NULL, 
                                       selected = NULL, 
                                       multiple = FALSE,
                                       options = NULL),
                        plotlyOutput('nnPlot')
               )
              )
              )
)


options(encoding = "UTF-8")

library(shiny)
library(dplyr)
library(DT)
library(plotly)


# processing of datasets

load("saveworkspace.RData")



# Define server logic required to draw a histogram
shinyServer(function(input, output, session) {
  
  #observe({
  #  showNotification("")
  #}) 
  #output$text <- renderText({ "Data is loading" })
  
  # update the input here. Doing this on the server should improve performance.
  updateSelectizeInput(session, 'var1adj', choices = adj_wordlist, server = TRUE)
  updateSelectizeInput(session, 'var1hadj', choices = hadj_wordlist, server = TRUE)
  updateSelectizeInput(session, 'var1vrb', choices = vrb_wordlist, server = TRUE)
  updateSelectizeInput(session, 'var1nn', choices = nn_wordlist, server = TRUE)
  
  
  #dataset for display
  output$adjtable = DT::renderDataTable({
    return(data_adj_small)
  })
  output$hadjtable = DT::renderDataTable({
    return(data_hadj_small)
  })
  output$vrbtable = DT::renderDataTable({
    return(data_vrb_small)
  })
  output$nntable = DT::renderDataTable({
    return(data_nn_small)
  })
  
  # filter data to create the frequency for graph
  # adj
  adj_count_filtered <- reactive({
    
    req(input$var1adj)
    
    word <- data_adj %>% 
      filter(Words == input$var1adj) #%>%
      #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    # this removes some unwanted data
    word <- word[-1]
    word <- head(word, -3)
    
    plot_data_count <- rbind(labels, word) %>%
      t() %>%
      data.frame()
    
    plot_data_count$word <- as.numeric(as.character(plot_data_count$word))
    
    return(plot_data_count)
  })
  
  adj_percent_filtered <- reactive({
    
    req(input$var1adj)
    
    word <- data_percent_adj %>% 
      filter(Words == input$var1adj) #%>%
      #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    word <- word[-1]
    word_percent <- head(word, -2)
    # change percentages from being 0 to 1 to being from 0 to 100%
    word_percent <- word_percent*100
    # round the percentage to 2 dec places
    word_percent <- format(round(word_percent, 2), nsmall = 2)
    
    plot_data_percent <- rbind(labels, word_percent) %>%
      t() %>%
      data.frame()
    
    plot_data_percent$word <- as.numeric(as.character(plot_data_percent$word_percent))
    
    return(plot_data_percent)
  })
  
  #hyphen adjs
  hadj_count_filtered <- reactive({
    
    req(input$var1hadj)
    
    word <- data_hadj %>% 
      filter(Words == input$var1hadj) #%>%
    #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    # this removes some unwanted data
    word <- word[-1]
    word <- head(word, -3)
    
    plot_data_count <- rbind(labels, word) %>%
      t() %>%
      data.frame()
    
    plot_data_count$word <- as.numeric(as.character(plot_data_count$word))
    
    return(plot_data_count)
  })
  
  hadj_percent_filtered <- reactive({
    
    req(input$var1hadj)
    
    word <- data_percent_hadj %>% 
      filter(Words == input$var1hadj) #%>%
    #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    word <- word[-1]
    word_percent <- head(word, -2)
    # change percentages from being 0 to 1 to being from 0 to 100%
    word_percent <- word_percent*100
    # round the percentage to 2 dec places
    word_percent <- format(round(word_percent, 2), nsmall = 2)
    
    plot_data_percent <- rbind(labels, word_percent) %>%
      t() %>%
      data.frame()
    
    plot_data_percent$word <- as.numeric(as.character(plot_data_percent$word_percent))
    
    return(plot_data_percent)
  })
  
  #verbs
  vrb_count_filtered <- reactive({
    
    req(input$var1vrb)
    
    word <- data_vrb %>% 
      filter(Words == input$var1vrb) #%>%
    #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    # this removes some unwanted data
    word <- word[-1]
    word <- head(word, -3)
    
    plot_data_count <- rbind(labels, word) %>%
      t() %>%
      data.frame()
    
    plot_data_count$word <- as.numeric(as.character(plot_data_count$word))
    
    return(plot_data_count)
  })
  
  vrb_percent_filtered <- reactive({
    
    req(input$var1vrb)
    
    word <- data_percent_vrb %>% 
      filter(Words == input$var1vrb) #%>%
    #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    word <- word[-1]
    word_percent <- head(word, -2)
    # change percentages from being 0 to 1 to being from 0 to 100%
    word_percent <- word_percent*100
    # round the percentage to 2 dec places
    word_percent <- format(round(word_percent, 2), nsmall = 2)
    
    plot_data_percent <- rbind(labels, word_percent) %>%
      t() %>%
      data.frame()
    
    plot_data_percent$word <- as.numeric(as.character(plot_data_percent$word_percent))
    
    return(plot_data_percent)
  })
  
  # nouns
  nn_count_filtered <- reactive({
    
    req(input$var1nn)
    
    word <- data_nn %>% 
      filter(Words == input$var1nn) #%>%
    #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    # this removes some unwanted data
    word <- word[-1]
    word <- head(word, -3)
    
    plot_data_count <- rbind(labels, word) %>%
      t() %>%
      data.frame()
    
    plot_data_count$word <- as.numeric(as.character(plot_data_count$word))
    
    return(plot_data_count)
  })
  
  nn_percent_filtered <- reactive({
    
    req(input$var1nn)
    
    word <- data_percent_nn %>% 
      filter(Words == input$var1nn) #%>%
    #as.numeric()
    suppressWarnings(word <- as.numeric(word))
    word <- word[-1]
    word_percent <- head(word, -2)
    # change percentages from being 0 to 1 to being from 0 to 100%
    word_percent <- word_percent*100
    # round the percentage to 2 dec places
    word_percent <- format(round(word_percent, 2), nsmall = 2)
    
    plot_data_percent <- rbind(labels, word_percent) %>%
      t() %>%
      data.frame()
    
    plot_data_percent$word <- as.numeric(as.character(plot_data_percent$word_percent))
    
    return(plot_data_percent)
  })
  
  
  
  # plots
  
  # adj
  output$adjPlot <- renderPlotly({
    
       
         
    
    ay <- list(
      overlaying = "y",
      side = "right",
      title = "Percent",
      showgrid = FALSE)
    
    fig <- plot_ly(data=adj_count_filtered(), 
                   x = ~labels, 
                   y = ~word, 
                   name = 'count', 
                   type = 'scatter', 
                   mode = 'lines+markers',
                   opacity = 0.9,
                   width = 1200, 
                   height = 700,
                   marker = list(
                     size = 4
                   ),
                   line = list(
                     width = 1
                   ))
    fig <- fig %>% add_trace(data=adj_percent_filtered(), 
                             y = ~word_percent, 
                             yaxis = "y2", 
                             name = 'percentage', 
                             mode = 'lines+markers',
                             opacity = 0.9,
                             line = list(
                               width = 1
                             ))
    # Change dimensions
    fig <- fig %>% layout(autosize = F,
                          title = paste("Usage of word: ", input$var1adj),
                          xaxis = list(title = "Texts", tickangle = 75),
                          yaxis = list(title = "Count"),
                          yaxis2 = ay)
    
    
  })
  
  # hyphen adj
  output$hadjPlot <- renderPlotly({
    ay <- list(
      overlaying = "y",
      side = "right",
      title = "Percent",
      showgrid = FALSE)
    
    fig <- plot_ly(data=hadj_count_filtered(), 
                   x = ~labels, 
                   y = ~word, 
                   name = 'count', 
                   type = 'scatter', 
                   mode = 'lines+markers',
                   opacity = 0.9,
                   width = 1200, 
                   height = 700,
                   marker = list(
                     size = 4
                   ),
                   line = list(
                     width = 1
                   ))
    fig <- fig %>% add_trace(data=hadj_percent_filtered(), 
                             y = ~word_percent, 
                             yaxis = "y2", 
                             name = 'percentage', 
                             mode = 'lines+markers',
                             opacity = 0.9,
                             line = list(
                               width = 1
                             ))
    # Change dimensions
    fig <- fig %>% layout(autosize = F,
                          title = paste("Usage of word: ", input$var1hadj),
                          xaxis = list(title = "Texts", tickangle = 75),
                          yaxis = list(title = "Count"),
                          yaxis2 = ay)
    
    
  })
  
  #verb plot
  output$vrbPlot <- renderPlotly({
    ay <- list(
      overlaying = "y",
      side = "right",
      title = "Percent",
      showgrid = FALSE)
    
    fig <- plot_ly(data=vrb_count_filtered(), 
                   x = ~labels, 
                   y = ~word, 
                   name = 'count', 
                   type = 'scatter', 
                   mode = 'lines+markers',
                   opacity = 0.9,
                   width = 1200, 
                   height = 700,
                   marker = list(
                     size = 4
                   ),
                   line = list(
                     width = 1
                   ))
    fig <- fig %>% add_trace(data=vrb_percent_filtered(), 
                             y = ~word_percent, 
                             yaxis = "y2", 
                             name = 'percentage', 
                             mode = 'lines+markers',
                             opacity = 0.9,
                             line = list(
                               width = 1
                             ))
    # Change dimensions
    fig <- fig %>% layout(autosize = F,
                          title = paste("Usage of word: ", input$var1vrb),
                          xaxis = list(title = "Texts", tickangle = 75),
                          yaxis = list(title = "Count"),
                          yaxis2 = ay)
    
    
  })
  
  # nouns
  output$nnPlot <- renderPlotly({
    ay <- list(
      overlaying = "y",
      side = "right",
      title = "Percent",
      showgrid = FALSE)
    
    fig <- plot_ly(data=nn_count_filtered(), 
                   x = ~labels, 
                   y = ~word, 
                   name = 'count', 
                   type = 'scatter', 
                   mode = 'lines+markers',
                   opacity = 0.9,
                   width = 1200, 
                   height = 700,
                   marker = list(
                     size = 4
                   ),
                   line = list(
                     width = 1
                   ))
    fig <- fig %>% add_trace(data=nn_percent_filtered(), 
                             y = ~word_percent, 
                             yaxis = "y2", 
                             name = 'percentage', 
                             mode = 'lines+markers',
                             opacity = 0.9,
                             line = list(
                               width = 1
                             ))
    # Change dimensions
    fig <- fig %>% layout(autosize = F,
                          title = paste("Usage of word: ", input$var1nn),
                          xaxis = list(title = "Texts", tickangle = 75),
                          yaxis = list(title = "Count"),
                          yaxis2 = ay)
    
    
  })
  
})

The log is as follows:

2022-10-15T15:07:48.628837+00:00 shinyapps[7315828]: Running on host: 527d94738aee
2022-10-15T15:07:48.628868+00:00 shinyapps[7315828]: Server version: 2022.09.0
2022-10-15T15:07:48.628873+00:00 shinyapps[7315828]: LANG: C.UTF-8
2022-10-15T15:07:48.628877+00:00 shinyapps[7315828]: Working directory: /srv/connect/apps/REHShiny7
2022-10-15T15:07:48.629115+00:00 shinyapps[7315828]: Running content using the current R environment
2022-10-15T15:07:48.633377+00:00 shinyapps[7315828]: R version: 4.2.1
2022-10-15T15:07:48.633398+00:00 shinyapps[7315828]: shiny version: 1.7.2
2022-10-15T15:07:48.633428+00:00 shinyapps[7315828]: httpuv version: 1.6.6
2022-10-15T15:07:48.633446+00:00 shinyapps[7315828]: rmarkdown version: (none)
2022-10-15T15:07:48.633453+00:00 shinyapps[7315828]: knitr version: (none)
2022-10-15T15:07:48.633458+00:00 shinyapps[7315828]: jsonlite version: 1.8.2
2022-10-15T15:07:48.633473+00:00 shinyapps[7315828]: RJSONIO version: (none)
2022-10-15T15:07:48.633476+00:00 shinyapps[7315828]: htmltools version: 0.5.3
2022-10-15T15:07:48.633503+00:00 shinyapps[7315828]: reticulate version: (none)
2022-10-15T15:07:48.633745+00:00 shinyapps[7315828]: Using pandoc: /opt/connect/ext/pandoc/2.16
2022-10-15T15:07:48.938227+00:00 shinyapps[7315828]: Starting R with process ID: '153'
2022-10-15T15:07:48.938891+00:00 shinyapps[7315828]: Shiny application starting ...
2022-10-15T15:07:48.966544+00:00 shinyapps[7315828]: Listening on http://127.0.0.1:39019
2022-10-15T15:07:49.252279+00:00 shinyapps[7315828]: Warning: Error in library: there is no package called ‘plotly’
2022-10-15T15:07:49.262074+00:00 shinyapps[7315828]: 87:
2022-10-15T15:07:49.262097+00:00 shinyapps[7315828]: 86: stop
2022-10-15T15:07:49.262102+00:00 shinyapps[7315828]: 85: library
2022-10-15T15:07:49.262118+00:00 shinyapps[7315828]: 15:
2022-10-15T15:07:49.262121+00:00 shinyapps[7315828]: 13: fn
2022-10-15T15:07:49.262687+00:00 shinyapps[7315828]: 8: retry
2022-10-15T15:07:49.262703+00:00 shinyapps[7315828]: 7: connect$retryingStartServer
2022-10-15T15:07:49.262707+00:00 shinyapps[7315828]: 6: eval
2022-10-15T15:07:49.262711+00:00 shinyapps[7315828]: 5: eval
2022-10-15T15:07:49.262714+00:00 shinyapps[7315828]: 4: eval
2022-10-15T15:07:49.262725+00:00 shinyapps[7315828]: 3: eval
2022-10-15T15:07:49.262728+00:00 shinyapps[7315828]: 2: eval.parent
2022-10-15T15:07:49.262731+00:00 shinyapps[7315828]: 1: local