What is MRO?
Microsoft distributes R that is bundled with the Intel MKL as well as various R packages. It is tested on selected supported operating systems and made available as Microsoft R Open (MRO), a free download. You can download MRO from MRAN, the Microsoft R Application Network.
Configuring RStudio Connect with MRO
MRO installs in locations where RStudio Connect does not scan automatically. After installing MRO, you must configure RStudio Connect to recognise the installed versions of MRO. To install a single version of MRO, edit your /etc/rstudio-connect/rstudio-connect.gcfg file, specifically editing the [Server] section:
For MRO-3.3.x:
[Server]
RVersion = /usr/lib64/microsoft-r/3.3/lib64/R
For MRO-3.4.x:
[Server]
RVersion = /opt/microsoft/ropen/3.4.3/lib64/R
Configuring RStudio Connect with MRO side-by-side
We recommend installing multiple versions of R side by side whenever you plan to host content on a server over time. Customers who use RStudio Connect should plan to support multiple versions of R. When you follow the MRO installation instructions, every (major/minor) MRO release will automatically install side-by-side, i.e. in a separate folder.
For example, to point to MRO-3.3.x as well as MRO-3.4.3, edit your /etc/rstudio-connect/rstudio-connect.gcfg file:
[Server]
RVersion = /usr/lib64/microsoft-r/3.3/lib64/R
RVersion = /opt/microsoft/ropen/3.4.3/lib64/R
Troubleshooting issues with MRO
Side-by-side installations with R
Microsoft does not support side-by-side installations of MRO with other distributions of R, including R binaries installed from CRAN. This means if you choose to use MRO as your R distribution, make sure you don't install R from other sources on the same machine.
Issues in finding the SSL CA certificate when using MRO
You may experience a problem related to the SSL certificate path, when using packages with a system dependency on CURL. This was reported on the MRO issue tracker, and the issue reports that this was fixed in MRO-3.3.2.
However, some users report that this problem recurs in later versions of MRO, including when they try to use the `checkpoint` package.
The symptom is an error message:
status was 'Problem with the SSL CA cert (path? access rights?)'
The workaround is to define an environment variable called CURL_CA_BUNDLE in your code (or in your `Rprofile.site`). This environment variable should point to a file "microsoft-r-cacert.pem" that is in the MRO installation folder.
Specifically, the workaround is to add the following line of code to the `Rprofile.site` file:
Sys.setenv(CURL_CA_BUNDLE = file.path(Sys.getenv("R_HOME"),
"lib/microsoft-r-cacert.pem"))
You can find the file `Rprofile.site`in the `etc` subfolder of your R installation. The various versions of MRO seem to use different conventions for where R gets installed. To find the installed location of R, use the linux command:
> R -e 'print(Sys.getenv("R_HOME"))'
This will print the installed path of your R installation. You can then use your favourite line editor to edit the Rprofile.site file. For example:
- For MRO-3.3.x:
sudo vi /usr/lib64/microsoft-r/3.3/lib64/R/etc/Rprofile.site
- For MRO-3.4.x:
sudo vi /opt/microsoft/ropen/3.4.3/lib64/R/etc/Rprofile.site
Alternatively, you can edit the `Renviron` file and add this line of code:
CURL_CA_BUNDLE=${R_HOME/lib/microsoft-r-cacert.pem}
Publishing content to RStudio Connect from MRO
By default, every release of MRO uses a static snapshot of CRAN, and changes the package repository to a snapshot date on MRAN. Specifically, this means that you will not have the most up-to-date versions of packages.
However, to publish content to RStudio Connect, you must have more recent versions of a number of packages, specifically the `rmarkdown` package and all of its dependencies.
To install all these packages from the CRAN mirror hosted by RStudio, use:
install.packages(
c("evaluate", "digest", "highr", "markdown", "stringr", "yaml",
"htmltools", "caTools", "knitr", "base64enc","rprojroot", "rmarkdown"
),
repos = c(CRAN = "https://cloud.r-project.org/")
)
Using RevoScaleR on RStudio Connect
Upon deployment of content, RStudio Connect recreates the developer's environment by installing the same version of all used packages from CRAN or an internal mirror. The RevoScaleR package comes pre-installed with several Microsoft R products and is not available on CRAN. Deployment of content will therefore fail, if RevoScaleR is explicitly loaded. However, RevoScaleR is typically loaded by default, which means that functions from this package can be used without explicitly loading it first. It is therefore best to not load RevoScaleR explicitly when deploying content to RStudio Connect.
Concretely, when deploying scripts to Connect, remove this line from your code:
library(RevoScaleR
Things to keep in mind
- Microsoft makes a release of MRO for every release of R. However, all MRO releases of major/minor version shares the same installation path. In other words, all releases of MRO-3.4.x share the same installation path. This means you can install MRO-3.3.x side-by-side with MRO-3.4.x, but side-by-side installation of MRO-3.4.1 and MRO-3.4.2 may not work.
- Make sure your operating system is supported (refer to the MRO system requirements). note also that you can only use a Linux operating system with RStudio Connect.
Comments