Trouble loading "Cairo" package after installing.

I'm new to R and just can't figure out what this error implies or how to solve it whenever I try to load Cairo

Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/romario/Documents/R/win-library/4.0/cairoDevice/libs/x64/cairoDevice.dll':
LoadLibrary failure: The specified module could not be found.
d.

Hi @Roma,
Welcome to the RStudio Community Forum.

First you need to run the following R command (either from the console or by using the "RStudio > Packages > Install" menu):

install.packages("Cairo")

Then run:

library(Cairo)

At which point (on a Windows machine) you will get a pop-window asking you for permission to download and install the GTK+ software. After that completes, you must restart R and then run

library(Cairo)

again. You should be then ready to "rock and roll". Not sure if this works the same on Mac/Linux.
If you still get the error try install.packages("cairoDevice") as well.
HTH

Hi @Roma,
Only other suggestion I have is the check whether you can use library(Cairo) in the R console. If yes, then I suspect you will need to post your Shiny code here to get further help.
HTH

Hi DavoWW,

Still no luck. Here is the code:

library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard"),
  dashboardSidebar(),
  dashboardBody(
    fluidRow(
      box(plotOutput("plot1", height = 250)),
      
      box(
        title = "Controls",
        sliderInput("slider", "Number of observations:", 1, 100, 50)
      )
    )
  )
)

server <- function(input, output) {
  set.seed(122)
  histdata <- rnorm(500)
  
  output$plot1 <- renderPlot({
    data <- histdata[seq_len(input$slider)]
    hist(data)
  })
}

shinyApp(ui, server)

@DavoWW !

Great news! I updated Rstudio. It seems to be working well now.

Thank you for working with me through this.

Best,

1 Like

This topic was automatically closed 21 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.

Hi DavoWW,

Thank you. I forgot to mention I've tried both of your suggestions in the past and still no success. I want to learn more about using Shiny to create dashboards. However, this error is preventing me from progressing. I still got it after installing cairoDevice

This error shows up in the window when trying to run the app/dashboard

"LoadLibrary failure: The specified procedure could not be found."