简体   繁体   中英

Error in library(data.table) : there is no package called 'data.table'

We have created a webservice on IIS which calls a R script. The R script includes some libraries like: data.table , caret and few a more. R is returning an error that it cannot find the data.table library:

"Error in library(data.table) : there is no package called 'data.table'".

We confirmed that the data.table package is installed in: "C:\\Program Files\\R\\R-3.3.3\\library\\data.table" . When we run .libPaths() to check where R tries to load the libraries from, it returns that this is the folder "C:/Program Files/R/R-3.3.3/library".

It does work successfully in a Visual Studio 2017 unit test or even in a console application environment. So the question is why can't R load the data.table library within IIS?

We using the following software versions:

  • R for Windows 3.3.3
  • Internet Information Services version 10.0.14393.0
  • RDotnet community 1.6.5

C# code:

R = REngine.GetInstance();
R.Initialize();
R.Evaluate("install.packages('data.table', repos='http://cran.us.r-project.org', dependencies = TRUE)");
R.Evaluate("library(data.table)");

We have decided to switch to 'Microsoft R Open' (MRAN) instead of R for Windows (CRAN). This solved a lot of problems for us. We couldn't get CRAN to work with IIS.

Only thing we need to do with MRAN is give the user the IIS application is running on modify access to the library folder at "C:\\Program Files\\Microsoft\\R Open\\library". This is needed to enable the R-engine within our application to install R-libraries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM