Search code examples
rrstudioubuntu-16.04revoscaler

RStudio not loading RevoScaleR on Ubuntu 16.04


Long story short:
Calling rxImport() works fine in a Terminal R session but fails when using RStudio, despite using the same installation of R.

Setup:
I'd like to use RevoScaleR functions like rxImport(...) on Ubuntu. I have an installation of RStudio and R done through package manager.

I've installed MS Rclient following the instructions here. Everything seems to work as I can run in the terminal:

/opt/microsoft/rclient/3.4.3/bin/R$ ./R

R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
Microsoft R Open 3.4.3
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2018 Microsoft

Loading Microsoft R Client packages, version 3.4.3.0097. 
Microsoft R Client limits some functions to available memory.
See: https://go.microsoft.com/fwlink/?linkid=799476 for information
about additional features.
...
Using the Intel MKL for parallel mathematical computing (using 2 cores).
Default CRAN mirror snapshot taken on 2018-01-01.
See: https://mran.microsoft.com/.

> R.home()
[1] "/opt/microsoft/rclient/3.4.3/runtime/R"
> rxImport()
Error in rxImport() : 'inData' must be specified.

So the function is loaded and available by default. Now I tell the RStudio to use this installation of R by adding the following at the end of ~/.profile :

RSTUDIO_WHICH_R="/opt/microsoft/rclient/3.4.3/bin/R/R"

Error:
When I run rstudio I get a R console in the IDE saying:

> R.home()
[1] "/opt/microsoft/rclient/3.4.3/runtime/R"
> rxImport()
Error in rxImport() : could not find function "rxImport"

Possible causes
I've found some threads with people complaining about MS packages not dealing properly with ~ and working directory (i.e. on a remote server), setwd() doesn't solve my issue, though.

Do you have any ideas on how to get RevoScaleR to work with RStudio? Thanks in advance.


Solution

  • An answer I got from Github: https://github.com/rstudio/rstudio/issues/2455#issuecomment-375327109

    try setting

    R_LIBS_SITE=/opt/microsoft/rclient/3.4.3/libraries/RServer
    

    in

    /opt/microsoft/rclient/3.4.3/runtime/R/etc/Renviron