Version/Environment (if relevant):
All Domino versions.
Applies to Domino Standard Environments prior to 5.2. Note that Domino Standard Environments are not version specific and can generally be used in any version of Domino. They are however tagged with the version of Domino where they were released.
Issue:
R package install fails within the Rconsole of the Rstudio IDE. If you are trying to install a package in the R console using for example...
install.packages("RcppParallel")
You may run in to any number of failures during the install. We'll use the RcppParallel as an example in this article, but the actual packages and failures may vary. For this package the failure is below
> install.packages("RcppParallel")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.us.r-project.org/src/contrib/RcppParallel_5.1.5.tar.gz'
Content type 'application/octet-stream' length 1967672 bytes (1.9 MB)
==================================================
downloaded 1.9 MB
* installing *source* package ‘RcppParallel’ ...
** package ‘RcppParallel’ successfully unpacked and MD5 sums checked
** using staged installation
** preparing to configure package 'RcppParallel' ...
** finished configure for package 'RcppParallel'
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.cpp -o init.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c options.cpp -o options.o
options.cpp:2:10: fatal error: RcppParallel.h: No such file or directory
2 | #include <RcppParallel.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:177: options.o] Error 1
ERROR: compilation failed for package ‘RcppParallel’
* removing ‘/usr/local/lib/R/site-library/RcppParallel’
Warning in install.packages :
installation of package ‘RcppParallel’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp3xuIxi/downloaded_packages’
Note: Most R package installs fail due to package dependency issues. These are not specific to Domino Environments and should be resolved by the user. In general package install issues are out of scope for Domino Support. But if you have been through the wringer with a package install, let us know and we'll try to give you some pointers.
Root Cause:
In this case and in many R package install failures, the root cause is that the R package needs to be installed as the root user. When you start a Domino workspace in Rstudio, the user in the Rstudio console is the ubuntu user.
Resolution:
There are several ways to install as the root user.
1) The most efficient method is to install the package directly in to the Compute Environment's docker definition. This will add the package permanently to the image for the Environment.
RUN R --no-save -e 'install.packages("RcppParallel")'
2) You can also add the install as a script in to the 'Pre Run Script' section of the Compute Environment definition. This will install the RcppParallel package at the start of each execution.
R --no-save -e 'install.packages("RcppParallel")'
3) From the Rstudio workspace switch to the terminal tab and switch to root...
#sudo su
then install RcppParallel...
#R --no-save -e 'install.packages("RcppParallel")'
Notes/Information:
Domino images created for 5.2 and beyond do not have this dependency and R packages can be installed without root privileges.
Comments
0 comments
Please sign in to leave a comment.