Installing R and R-packages
Installing a new R release and a bundle of default user packages is streamlined with some scripts. This text is for administrators of the R installation. Other users may find some hints here, if their installation to $HOME fails.
Installing R
Make a new directory. It is strongly suggested, to follow the form /sw/viz/R/R-4.0.2/skl. Copy the installation scripts into this directory. Do not forget, other members of the sw-group may need to install here too.
$ cd /sw/viz/R/R-4.0.2/skl $ cp ../../scripts/* . $ chmod g+rwX *
Edit the script getR and update the version number. Run getR. This downloads the requested version of R, inflates und unpacks the tar-file and renames the source directory into build. Note, if you download otherwise, please rename the R-directory into build, if you want to use the script install_R.
$ ./get_R
- Check or edit the script install_R. You may change there:
- the default compiler to be used for building R and R packages. This compiler needs to be compatible with the compiler used for external packages like netcdf, openmpi, magick etc. If you change the default compiler, please change the other scripts too - see below.
- the options for running configure
- compiler options, especially the degreee of optimisation and rpath. These options will be part of the default settings to be used by Rscript when building packages.
- Run install_R. The script will stop several times requesting ENTER to continue. This helps to see, if the configuration, compilation and all checks are finished with reasonable output. Note, the script changes permissions in the end, to allow other members of the sw-group to install there too.
$ ./install_R
- Produce a module file. It should be sufficient, to copy that of the previous version and to change the version number in the file.
Single R-package installation
Before a package is installed, the correct compiler module must be loaded. Otherwise the system compiler is used. Since c++ is used a lot, this may result in an inconsistent package library. It is not needed, to load a R-module file, when the scripts described below are used.
Package installation may be done with the help of Rscript or directly from R or rstudio. We recommend to use our scripts instead, since
- they load the default compiler compatible with R
- contain fixes and workarounds needed to install some packages
- set the permissions for the installed files, which is often forgotten
- help with bookkeeping of package lists.
The scripts produce a one line script executed immediately by Rscript. It employs mainly the R-libraries install.packages (not to mix with our script with the same name!) or githubinstall.
We support three different repositories:
- cran (https://cran.uni-muenster.de/): the main repository for releases of R package
$ ./install_cran <packagename>
- github: the detailed search for the package is done with githubinstall used by R.
$ ./install_github <packagename>
- BiocManager (https://www.bioconductor.org/install): a specific repository providing tools for the analysis and comprehension of high-throughput genomic data.
$ ./install_bioc <packagename> <version>
The version is optional.
If the installation is successful, the scripts prompt to ask for adding the package into a list of packages that will be installed by default with a new R version. In this case, one of the package lists in /sw/viz/R/package_list is updated, a copy of the previous list is stored in /sw/viz/R/package_list_save. These lists can be edited by hand.
To remove a package, you may use
$ ./remove_package <packagename>
Automatic removal from the list of default packages is not implemented yet.
Default R-packages
To install the bundle of predefined R-packages, use the script install_packages. It
- loads the appropriate compiler module
- employs install_cran, install_github and install_bioc to install the packages
- sets the correct permissions for the installed files and libraries
- documents success or failure of the installation
$ ./install_packages
The lists are located in /sw/viz/R/package_list. They can be maintained with any editor. They are the result of user requests in the past. They are over-complete, since many packages are installed in any case as prerequisite for other packages. Success or failure are reported in packages_success.log and packages_failed.log.
Using install_packages is coffee consuming. The script needs several hours to install the full list of packages. Some prerequisites are installed several times.
Known issues
The installation of some packages fails and is reported in packages_failed.log. Repeating the installation of the single packages helps in all cases, the reason is unknown. Search in /sw/viz/R/package_list, which install source is the appropriate one. Using github instead of cran may result in a long lasting version update of all prerequisites. However, no package failure has been reported anyway.
Rmpi is linked with openmpi. The intel compilers and impi are not tested yet.
Some packages do not set rpath properly, do not accept libraries at non-default places or do not consider the flags configure.vars and configure.args used by the R-package install.packages. In this case, there are limited means to propagate information on include paths or rpath to the package installation process. One way to do this, is to put the appropriate compiler flags in ~/.R/Makevars. The scripts do not overwrite this file, but save a copy fist that is restored in the end of the package installation.