1
votes

I am hoping to write a shiny package that depends on an external ubuntu package/library. In this case pdftk. In the most basic case

server.R

shinyServer(function(input, output) {

  output$text <- renderText({
      call = system2('pdftk',stdout = TRUE)
      'meh'
  })
})

ui.R

shinyUI(fluidPage(
  textOutput("text")
))

Gives the log message sh: 1: pdftk: not found in shinyapps.io dashboard. Is there a way to request shinyapps.io server to install required linux dependencies?

Note: this has been hard to google as package and dependency tend to give me links related to R packages. If anyone has better keywords in mind I can edit the post.

1
Before checking on shinyapps.io dashboard, Did it work on your local machine?amrrs
My guess would be that pdftk is not accessible through $PATH. This can happen if your R session doesn't have all the privileges you're assuming it has.Roman Luštrik
@amrrs If I run it in a local machine, it'll give me the SYNOPSIS pdftk... thing that pops up. @roman, That may be the case but my guess it it's not even installed. It was installed in my ubuntu machine by default but not in the windows subsystem so I guess it's possible that it just comes without it.OganM
shinyapps needs all the dependencies to be within the project. They clearly state in one of the FAQs that you should file an issue if you need other operating system packages/binaries to be available. support.rstudio.com/hc/en-us/articles/… Every OS pkg/app extends the attack surface area of the linux systems they build so don't be sad if they reject this, especially since R has the pdftools packagehrbrmstr
I see, thanks. I want to fill a pdf form with this so i think it's outside the scope of pdftoolsOganM

1 Answers

0
votes

As @hrbmrstr stated, the way to add additional dependencies is to the github repo for shiny app dependencies. This repo includes code that is excecuted before a dependent package is installed. Which means whatever dependency you want to add must be required for a package or it'll never be loaded.

Based on this pull request, the package does not have to be on CRAN but I am unsure if they'll accept every dependency for everyone's random packages.

In the case of pdftk, animation package already used pdftk but did not enforce it's presence. I opened a pull request that includes installation of pdtfk to the pre-installation code for animation which is now accepted. This means as long as the app uses animation package, pdftk will be installed in the system and can be used with either pdtk function of animation or by system/system2.