Hello,
I work in a small company where few people use R, I’d like to be able to deploy several R versions installed alongside one another.
Deploying is not an issue but I do not know how to properly install many versions of R to be used by many users.
Is there a clear step by step tutorial ? We are using centos 7.
Regards
This is a great request! Thanks @statquant - I'll see if I can put a short video together this week.
Amazing !
Many thanks for your time.
Regards
On this topic, I've also been trying to install multiple version of R for use with our company RStudio Server Pro install (1.2.1335). Running on Ubuntu 16.04, we use the base install of R (which Ubuntu auto updates to latest version, currently 3.6.0) so we need to compile specific version of R from source in /opt/R/version
. I've set up site-library locations in /usr/local/lib/R-MAJOR-MINOR/site-library
to manage packages which can be shared by matching installs of R in /opt/R/MAJOR-MINOR-SUBMINOR
. I followed article 215488098 to build from source and tried building against system blas/lapack libs.
Now, to make the built versions of R work correctly, RStudio needs to set up library paths correctly - there are docs here for this running on a single install of R here: https://docs.rstudio.com/ide/server-pro/r-sessions.html#r-executable-and-libraries. There are also enhancements to RStudio Server Pro to run individual configuration scripts for each version of R here: https://docs.rstudio.com/ide/server-pro/r-versions.html#using-multiple-versions-of-r-concurrently (running modules or scripts to configure each of these), but no examples of a configuration.
My question is, how do I ensure the correct dynamic library path is configured to run more than just the default pre-installed R version. What is the interaction of the /etc/rstudio/rserver.conf
variables with the scripts that can be configured in /etc/rstudio/r-versions
? Do these script come before/after/instead of rserver.conf variable processing ? How does the module work instead of a script, what's recommended ?
I am currently getting errors if I switch to any built-from-source R versions - basic print breaks indicating that R cannot even find its standard library (to avoid complications I built R from source using the most basic config: ./configure --prefix=/opt/R/VERSION --enable-R-shlib
) - clearly LD_LIBRARY_PATH is not getting set correctly. I am about to do some more digging turning on diagnostics etc, but an extended example to make all this work would be appreciated to promote best practices!
More info on this:
I installed a few test versions of R in /opt/R/VERSION
as indicated above and set up /etc/rstudio/r-versions
like so:
Path: /opt/R/3.5.2
Label: R 3.5.2
Path: /opt/R/3.5.3
Label: R 3.5.3
Path: /opt/R/3.6.0
Label: R 3.6.0
Path: /usr/lib/R
Label: System R
/etc/rstudio/rserver.conf looks like this:
# Server Configuration File
www-port=8899
#rsession-which-r=/opt/R/3.5.2/bin/R
server-license-type=remote
r-versions-scan=1
admin-enabled=1
admin-group=rstudio-admins
rsession-diagnostics-enabled=1
Switching to one of the built versions of R in the Studio context menu fails to switch to the required version of R and gives the following errors (in console):
Error in .Internal(print.function(x, useSource, ...)) :
there is no .Internal function 'print.function'
Looking into the session log starting with the switch to R 3.5.3, this is the output (libR.so seems to be found - I'm removing proxy settings which are irrelevant here)
[Wed May 22 12:17:43 AEST 2019] ---- launching rsession process ----
[Wed May 22 12:17:43 AEST 2019] ---- final env ----
[Wed May 22 12:17:43 AEST 2019] RS_SESSION_SERVER_RPC_SECRET=bc7304ed5f324a58a962f179620d4952
R_INCLUDE_DIR=/opt/R/3.5.3/lib/R/include
RSTUDIO_DEFAULT_R_VERSION=3.6.0
RSTUDIO_REQUIRED_USER_GROUP=
RSTUDIO_MULTI_SESSION=1
RSTUDIO_VERSION=1.2.1335-1
RSTUDIO_LIMIT_RPC_CLIENT_UID=999
RSTUDIO_R_MODULE=
RSESSION_PROFILE_OPTIONS=
RS_R_VERSIONS_PATH=/var/lib/rstudio-server/r-versions
LD_LIBRARY_PATH=/opt/R/3.5.3/lib/R/lib::/lib:/usr/local/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
RS_MONITOR_SHARED_SECRET=8bdeb08d-0c8c-4de8-abe8-a661b1a9bbee
RSESSION_DIAGNOSTICS_FILE=/tmp/rsession-diagnostics-w49700-20a96e6f.log
RSTUDIO_USER_HOME_PAGE=1
RSTUDIO_R_PRELAUNCH_SCRIPT=
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=/
R_SHARE_DIR=/opt/R/3.5.3/lib/R/share
LANG=en_US.UTF-8
RSTUDIO_MINIMUM_USER_ID=1000
RSTUDIO_R_VERSION_LABEL=R 3.5.3
RSESSION_DIAGNOSTICS_ENABLED=1
SHLVL=1
R_HOME=/opt/R/3.5.3/lib/R
R_DOC_DIR=/opt/R/3.5.3/lib/R/doc
RSTUDIO_DEFAULT_R_VERSION_HOME=/usr/lib/R
_=/usr/bin/printenv
[Wed May 22 12:17:43 AEST 2019] ---- ldd output ----
[Wed May 22 12:17:43 AEST 2019] linux-vdso.so.1 => (0x00007ffdce5f3000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd6458c5000)
libR.so => /opt/R/3.5.3/lib/R/lib/libR.so (0x00007fd64524a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd64502d000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fd644e2a000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fd644c25000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd644a1d000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd644803000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fd64459a000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fd644155000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd643dd3000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd643aca000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd6438b4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd6434ea000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd646c08000)
libRblas.so => /opt/R/3.5.3/lib/R/lib/libRblas.so (0x00007fd6432bd000)
libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007fd643077000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd642e07000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fd642be5000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007fd6429d5000)
libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007fd642641000)
libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007fd6421df000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fd641fbd000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fd641d94000)
libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007fd6402dd000)
RStudio has failed to switch R versions, showing R version as R 3.6.0 (using R.version and console manifest) still with errors at every command. I tried this on an existing project and a new project choosing R 3.5.3 configuring the new project. Running this R version from console works fine (given the R script which configures necessary env vars with paths before invoking the binary - RStudio does not use this script for obvious reasons so need to understand which order/which config files should be set up to achieve the same, R version install specific, effect).
Digging a bit further, it appears LD_LIBRARY_PATH is NOT set appropriately for this R version - in RStudio (/opt/R/3.5.3/lib/R/lib
is appended way down the chain as opposed to being picked up earlier)
/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:/opt/R/3.5.3/lib/R/lib::/lib:/usr/local/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
compared to console invocation of R 3.5.3:
/opt/R/3.5.3/lib/R/lib:/usr/local/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server:/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:
where you can see /opt/R/3.5.3/lib/R/lib
being prepended to the path. However according to the rsession log, R should be happy as it's found the right libR.so
Thanks in advance!
Bernard
P.S. I had to mangle the references in this post as I'm a new user and not allowed to put more than 2 links ?
For benefit of the community, I add more diagnostics so RStudio team can help resolve:
Switched off r-versions-scan=1
(commented out) and ran sudo rstudio-server verify-installation
.
As indicated above, the additional (source build) install of R work from command line, but not from RStudio (incorrect dynamic library path config causing R not to find the correct dependencies like libR.so). As requested by Steve, see below for dump of one of the installed R versions (others were installed identically):
-
Sys.getenv()
from RStudio running R 3.5.3
LANG en_US.UTF-8
LD_LIBRARY_PATH /opt/R/3.5.3/lib/R/lib::/lib:/usr/local/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
LD_PRELOAD /lib/x86_64-linux-gnu/libSegFault.so
LN_S ln -s
MAKE make
PAGER /usr/bin/less
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD /
R_BROWSER /usr/bin/firefox
R_BZIPCMD /bin/bzip2
R_DOC_DIR /opt/R/3.5.3/lib/R/doc
R_GZIPCMD /bin/gzip
R_HOME /opt/R/3.5.3/lib/R
R_INCLUDE_DIR /opt/R/3.5.3/lib/R/include
R_LIBS_SITE
R_LIBS_USER ~/R/x86_64-pc-linux-gnu-library/3.5
R_PACKRAT_DEFAULT_LIBPATHS /home/wde.woodside.com.au/w49700/R/x86_64-pc-linux-gnu-library/3.5:/usr/local/lib/R-3.5/site-library:/opt/R/3.5.3/lib/R/library
R_PACKRAT_SITE_LIBRARY /opt/R/3.5.3/lib/R/site-library
R_PACKRAT_SYSTEM_LIBRARY /opt/R/3.5.3/lib/R/library
R_PAPERSIZE letter
R_PDFVIEWER /usr/bin/xdg-open
R_PLATFORM x86_64-pc-linux-gnu
R_PRINTCMD
R_RD4PDF times,inconsolata,hyper
R_SESSION_TMPDIR /tmp/RtmpBlPhS2
R_SHARE_DIR /opt/R/3.5.3/lib/R/share
R_SYSTEM_ABI linux,gcc,gxx,gfortran,?
R_TEXI2DVICMD /usr/bin/texi2dvi
R_UNZIPCMD /usr/bin/unzip
R_ZIPCMD /usr/bin/zip
RMARKDOWN_MATHJAX_PATH /usr/lib/rstudio-server/resources/mathjax-26
RS_RPOSTBACK_PATH /usr/lib/rstudio-server/bin/rpostback
RSESSION_DIAGNOSTICS_ENABLED 1
RSESSION_DIAGNOSTICS_FILE /tmp/rsession-diagnostics-w49700-228db435.log
RSESSION_PROFILE_OPTIONS --noprofile --norc
RSTUDIO 1
RSTUDIO_CONSOLE_COLOR 256
RSTUDIO_CONSOLE_WIDTH 140
RSTUDIO_HTTP_REFERER http://awaucdpln04d:8899/s/017fa86b04643228db435/
RSTUDIO_MULTI_SESSION 1
RSTUDIO_PANDOC /usr/lib/rstudio-server/bin/pandoc
RSTUDIO_R_MODULE
RSTUDIO_R_PRELAUNCH_SCRIPT
RSTUDIO_R_VERSION_LABEL R 3.5.3
RSTUDIO_SESSION_STREAM w49700-ds/017fa86b04643/228db435
RSTUDIO_USER_IDENTITY w49700
RSTUDIO_WINUTILS bin/winutils
- Running from command line
/opt/R/3.5.3/bin/R
:
LANG en_US.UTF-8
LD_LIBRARY_PATH /opt/R/3.5.3/lib/R/lib:/usr/local/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server:/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:
LD_LIBRARY_PATH_WITH_DEFAULT_CUDA
/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:/lib/nccl/cuda-9.0/lib/:
LD_LIBRARY_PATH_WITHOUT_CUDA
/usr/lib64/openmpi/lib/:/usr/local/lib:/usr/lib:/usr/local/mpi/lib:/lib/:
LINES 82
LN_S ln -s
MAKE make
PAGER /usr/bin/less
PATH /home/ubuntu/anaconda3/bin:/usr/local/cuda/bin:/usr/local/bin:/opt/aws/bin:/usr/local/mpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PKG_CONFIG_PATH /usr/local/lib/pkgconfig:
PWD /home/wde.woodside.com.au/w49700
R_ARCH
R_BROWSER /usr/bin/firefox
R_BZIPCMD /bin/bzip2
R_DOC_DIR /opt/R/3.5.3/lib/R/doc
R_GZIPCMD /bin/gzip
R_HOME /opt/R/3.5.3/lib/R
R_INCLUDE_DIR /opt/R/3.5.3/lib/R/include
R_LIBS_SITE
R_LIBS_USER ~/R/x86_64-pc-linux-gnu-library/3.5
R_PAPERSIZE letter
R_PDFVIEWER /usr/bin/xdg-open
R_PLATFORM x86_64-pc-linux-gnu
R_PRINTCMD
R_RD4PDF times,inconsolata,hyper
R_SESSION_TMPDIR /tmp/RtmpxOh6i4
R_SHARE_DIR /opt/R/3.5.3/lib/R/share
R_SYSTEM_ABI linux,gcc,gxx,gfortran,?
R_TEXI2DVICMD /usr/bin/texi2dvi
R_UNZIPCMD /usr/bin/unzip
R_ZIPCMD /usr/bin/zip
-
env
from command line:
TERM=xterm
SHELL=/bin/bash
GTK_MODULES=gail:atk-bridge
SSH_TTY=/dev/pts/2
USER=w49700
LD_LIBRARY_PATH=/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:
LD_LIBRARY_PATH_WITH_DEFAULT_CUDA=/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:/lib/nccl/cuda-9.0/lib/:
MAIL=/var/mail/w49700
PATH=/home/ubuntu/anaconda3/bin:/usr/local/cuda/bin:/usr/local/bin:/opt/aws/bin:/usr/local/mpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=/home/wde.woodside.com.au/w49700
LANG=en_US.UTF-8
LD_LIBRARY_PATH_WITHOUT_CUDA=/usr/lib64/openmpi/lib/:/usr/local/lib:/usr/lib:/usr/local/mpi/lib:/lib/:
KRB5CCNAME=FILE:/tmp/krb5cc_563257722
SHLVL=1
HOME=/home/wde.woodside.com.au/w49700
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:
DISPLAY=localhost:11.0
_=/usr/bin/env
Hmm, so now it appears the misplaced /opt/R/3.5.3/lib/R/lib
appears at the top of the search path for LD_LIBRARY_PATH
for both RStudio and R command line configs and both environments are behaving now - compare this to the dump I included in the previous message - what caused the "magic" fix (all other things being equal ?). Is it the scan option (which is on by default ?). Could you please elaborate where/how should we add any additional library paths as necessary ? ie how does RStudio resolve/augment env vars in similar fashion to what the R command line bash wrapper does ?
Thanks
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.