Bachkippe
Bachkippe

Reputation: 83

Shiny Server not able to load installed package

I have a problem deploying my application to Shiny Server.

The application is loading (or at least the ui.R is loaded) so I'm able to see the user interface. But the execution stops there, and the following is dumped to my JS console:

Attaching package: ‘shinydashboard’

The following object is masked from ‘package:graphics’:

box

Loading required package: bitops Error in library(data.table) : there
  is no package called ‘data.table’

The last line is indicating the problem to be the data.table package.

I checked my Shiny Server installation and data.table is correctly installed. I can load the package in my R console on the server, both as normal user and as sudo user.

I'm not even using this package directly, so I guess it's some sort of dependency.

Do you have any idea?

Edit: The minimal example of this problem is reproducible by using the lesson 1 example from the shiny tutorial: http://shiny.rstudio.com/tutorial/lesson1/ and including library(data.table)

If you need the data.table package for combining data.frames, I found some workaround by using the dplyr function rbind_all instead of rbindlist from data.table (keep in mind this is significantly slower)

Upvotes: 1

Views: 3170

Answers (2)

Bachkippe
Bachkippe

Reputation: 83

Thanks you @lbollar and @MarkeD! Installing the chron package and the install_github version of data.table fixed my problem.

Upvotes: 1

lbollar
lbollar

Reputation: 1034

When I recently deployed shiny on an ec2 instance, I had a similar problem. Run library() without parameters and take a look at your different package directories. I believe the default directory for packages that shiny uses that my image came with is '/usr/local/lib/R/site-library’.

When I install packages, I make sure to explicitly state the path to be installed with lib=, install.packages("data.table",lib="/usr/local/lib/R/site-library")

Upvotes: 2

Related Questions