Installing every CRAN package in R on CentOS 7

Step 1: Install CentOS 7 Linux.

Some R packages will not install without an active X window session, so if you are not logged in to a graphical interface on the machine you will need to connect via SSH with X-forwarding enabled, such as with PuTTY and VcXsrv on Windows.

Most of this guide must be run from the Linux terminal as the user who will be running R. That user must be allowed to run commands as root with sudo.

Start by updating the system.

sudo yum update -y

Use your favourite text editor (I prefer nano) to create this new file…

sudo nano /etc/yum.repos.d/jags.repo

With the following content in it:

[home_cornell_vrdc]
name=Sundry packages for scientific computing (CentOS_7)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/cornell_vrdc/CentOS_7/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/cornell_vrdc/CentOS_7//repodata/repomd.xml.key
enabled=1

Some R packages require libraries or development packages from the CentOS software repository.

sudo yum groups mark convert

sudo yum install epel-release -y

sudo yum groupinstall "Development tools" -y

sudo yum install wget openblas java-1.8.0-openjdk-devel zlib-devel libicu-devel libpng-devel libcurl-devel libxml2-devel openssl-devel openmpi-devel numpy python-matplotlib netcdf4-python netcdf-devel netcdf python-pandas python-basemap proj-epsg proj-devel gdal-devel monitorix gnuplot ImageMagick librsvg2-devel libsodium-devel libwebp-devel cairo-devel hunspell-devel openssl-devel poppler-cpp-devel protobuf-devel mariadb-devel mysql-devel v8-devel redland-devel cyrus-sasl-devel libtiff-devel tcl-devel tk-devel xauth mesa-libGLU-devel glpk-devel libXt-devel gsl-devel fftw-devel bzip2-devel geos-devel gtk2-devel gtk3-devel libjpeg-turbo-devel jags4-devel bwidget blas-devel lapack-devel mpfr-devel unixODBC-devel libsndfile-devel udunits2-devel postgresql-devel libRmath-devel qt-devel libdb-devel octave-devel hiredis-devel poppler-glib-devel QuantLib-devel boost-devel czmq-devel ImageMagick-c++-devel file-devel -y

Install CRAN R.

sudo yum install R -y

Replace the included libRblas.so with a better one from OpenBLAS.

sudo mv /usr/lib64/R/lib/libRblas.so /usr/lib64/R/lib/libRblas.so_

sudo ln -s /usr/lib64/libopenblas.so.0 /usr/lib64/R/lib/libRblas.so

Set up R Java.

sudo env PATH=/usr/local/bin:$PATH R CMD javareconf

Set up OpenMPI.

sudo echo "/usr/lib64/openmpi/lib" > /etc/ld.so.conf.d/openmpi.conf

sudo ldconfig

Install ggobi.

wget http://www.ggobi.org/downloads/ggobi-2.1.11.tar.bz2

bunzip2 ggobi-2.1.11.tar.bz2

tar -xf ggobi-2.1.11.tar

cd ggobi-2.1.11

./configure --with-all-plugins

make

sudo make install

make ggobirc

sudo mkdir -p /etc/xdg/ggobi

sudo cp ggobirc /etc/xdg/ggobi/ggobirc

sudo ln -s /usr/local/lib/libggobi.so.0 /usr/lib64/libggobi.so.0

cd ..

Install Intel OpenCL.

wget http://registrationcenter-download.intel.com/akdlm/irc_nas/9019/opencl_runtime_16.1.1_x64_rh_6.4.0.25.tgz

tar -xzf opencl_runtime_16.1.1_x64_rh_6.4.0.25.tgz

sudo yum install opencl_runtime_16.1.1_x64_rh_6.4.0.25/rpm/*

Install SYMPHONY.

wget http://www.coin-or.org/download/source/SYMPHONY/SYMPHONY-5.6.14.tgz

tar -xzf SYMPHONY-5.6.14.tgz

cd SYMPHONY-5.6.14

./configure

make

sudo make install

sudo cp -R include/* /usr/include/

sudo cp -R bin/* /usr/bin/

sudo cp -R lib/* /usr/lib64/

sudo cp -R share/* /usr/share/

cd ..

Install OpenBugs.

sudo yum install http://pj.freefaculty.org/EL/7/x86_64/openbugs-3.2.3-1.x86_64.rpm

Download the CUDA repository for Linux x86_64 from developer.nvidia.com/cuda-downloads and follow the instructions to install it, then install CUDA.

sudo yum install cuda

Create this file…

sudo nano /etc/profile.d/custom.sh

With this content in it:

export CPATH=\$CPATH:/usr/include/openmpi-x86_64
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:${LD_LIBRARY_PATH}

Download the actuar package source from the CRAN website and extract it.

wget https://cran.r-project.org/src/contrib/actuar_1.2-2.tar.gz

tar -xzf actuar_1.2-2.tar.gz

Edit this file…

nano actuar/src/locale.h

And remove some lines so it looks like this:

/* Localization */
#include <R.h>
#define _(String) (String)

Then re-compress the package and install it.

tar -czf actuar_fixed.tar.gz actuar

R CMD INSTALL actuar_fixed.tar.gz

Repeat the above steps for the CRAN packages expm and GNE because they have the same problem in locale.h

Now run R. The rest of these commands must be entered into R.

R

Install devtools.

install.packages('devtools')

Load devtools and install RSQLServer 0.3 from GitHub because RSQLServer 0.2 on CRAN is broken.

library(devtools)

devtools::install_github('imanuelcostigan/RSQLServer')

Install the alternate package repository Bioconductor to help with prerequisite packages that are missing from CRAN.

source("https://bioconductor.org/biocLite.R")

These packages are not available in the CRAN repository, but they are required by other packages in CRAN.

biocLite(c("DNAcopy", "SAGx", "aroma.light", "aroma.core", "genefilter", "limma", "DESeq", "graph", "Rgraphviz", "genefilter", "edgeR", "RDAVIDWebService", "sva", "fabia", "beadarray", "geneplotter", "biomaRt", "Biostrings", "GOSemSim", "qvalue", "DESeq2", "marray", "GEOquery", "GenomicRanges", "GenomeInfoDb", "pcaMethods", "chopsticks", "RBGL", "BSgenome", "BSgenome.Hsapiens.UCSC.hg19", "affxparser", "affy", "oligo", "supraHex", "siggenes", "gcrma", "Rsamtools", "GenomicAlignments", "impute", "flowWorkspace", "flowCore", "breastCancerVDX", "snpStats", "EBImage", "rtracklayer", "GenomicFeatures", "genoset", "nem", "a4Core", "Icens", "lfa", "org.Hs.eg.db", "GOstats", "pdInfoBuilder", "convert", "GEOmetadb", "annotate", "simpleaffy", "lumi", "globaltest", "ssize", "GeneMeta", "MergeMaid", "metaArray", "seqLogo", "GlobalAncova", "GSVA", "mzR", "xcms", "vsn", "minet", "ShortRead", "safe", "piano", "LBE", "survcomp", "fmcsR", "ChemmineR", "KEGGREST", "widgetTools", "copynumber", "phyloseq", "MassSpecWavelet", "MAIT", "CNTools", "qpgraph", "topGO", "kelvin", "miscF", "randtoolbox", "mcGlobaloptim", "ycinterextra", "DiceOptim", "GPareto", "KrigInv", "bamsignals", "Rdisop", "KEGGgraph", "VariantAnnotation", "iBBiG", "rqubic", "BicARE", "CMA", "affyPLM"))

Install tcltk2 separately from everything else because sometimes it causes an infinite loop during installation and you will have to kill the R process.

install.packages('tcltk2')

Install udunits2 and Rmpi separately because they require special configuration arguments.

install.packages('udunits2',configure.args='--with-udunits2-include=/usr/include/udunits2')

install.packages('Rmpi',configure.args = '--with-Rmpi-include=/usr/include/openmpi-x86_64 --with-Rmpi-libpath=/usr/lib64/openmpi/lib --with-Rmpi-type=OPENMPI')

Get a list of all the available packages on CRAN.

availablePackages <- names(available.packages()[,1]);

And a list of all the packages already installed.

installedPackages <- names(installed.packages()[,'Package']);

Make a list of packages that you do not want to install because they require commercial software or hardware that you probably don’t have.

badPackages <- c("rngWELL", "randtoolbox", "cda", "cepp", "copBasic", "DiceOptim", "ESGtoolkit", "FDGcopulas", "GPareto", "GPC", "iterLap", "KrigInv", "mcGlobaloptim", "minimaxdesign", "moko", "ndjson", "TruncatedNormal", "ycinterextra", "ROracle", "ora", "cplexAPI", "ROI.plugin.cplex", "Rcplex", "Rmosek", "REBayes", "RcppAPT", "rLindo", "sybilSBML", "RSAP", "gmatrix", "BRugs", "agRee", "miscF", "PottsUtils", "rngWELL", "randtoolbox", "cda", "cepp", "copBasic", "DiceOptim", "ESGtoolkit", "FDGcopulas", "GPareto", "GPC", "iterLap", "KrigInv", "mcGlobaloptim", "minimaxdesign", "moko", "ndjson", "TruncatedNormal", "ycinterextra", "ROracle", "ora", "cplexAPI", "ROI.plugin.cplex", "Rcplex", "Rmosek", "REBayes", "RcppAPT", "rLindo", "sybilSBML", "RSAP", "gmatrix")

Now calculate the list of packages to be installed, and install them all.

installPackages <- availablePackages[!availablePackages %in% installedPackages]; 

installPackages <- installPackages[!installPackages %in% badPackages]

install.packages(installPackages)

You should now have about 9383 R packages installed.

These packages are in the badPackages list because they cannot be installed without commercial software or hardware:

rngWELL requires a hardware random number generator.
randtoolbox requires rngWELL
cda requires randtoolbox
cepp requires randtoolbox
copBasic requires randtoolbox
DiceOptim requires randtoolbox
ESGtoolkit requires randtoolbox
FDGcopulas requires randtoolbox
GPareto requires randtoolbox
GPC requires randtoolbox
iterLap requires randtoolbox
KrigInv requires randtoolbox
mcGlobaloptim requires randtoolbox
minimaxdesign requires randtoolbox
moko requires randtoolbox
ndjson requires randtoolbox
TruncatedNormal requires randtoolbox
ycinterextra requires randtoolbox
ROracle requires Oracle Call Interface.
ora requires ROracle
cplexAPI requires IBM ILOG CPLEX.
ROI.plugin.cplex requires IBM ILOG CPLEX.
Rcplex requires IBM ILOG CPLEX.
Rmosek requires MOSEK.
REBayes requires Rmosek
RcppAPT requires a Debian-based Linux system.
rLindo requires LINDO.
sybilSBML  requires libSBML, which is currently broken on CentOS 7.
RSAP requires SAP NetWeaver RFC SDK.
gmatrix requires a Nvidia GPU.

These packages failed to install for me. They might require additional configuration, or they might just be broken.

BRugs configure: error: C compiler cannot create executables.
agRee requires BRugs
miscF requires BRugs
PottsUtils requires BRugs
deeplearning
Error : object ‘createDataSet’ is not exported by ‘namespace:darch’
gputools gcc: error: unrecognized command line option ‘-Wp’
HiPLARM Install guide appears to be outdated, installation script is broken.
largeVis error: invalid initialization of non-const reference of type ‘Progress&’ from an rvalue of type ‘<brace-enclosed initializer list>’
qtpaint *** No rule to make target `install’.  Stop.
Rarity Error in untar2: incomplete block on file.
RDieHarder error: Library libdieharder.so not in .
Rhpc error: can not link MPI library.
RQuantLib error: ‘HalfMonthModifiedFollowing’ is not a member of ‘QuantLib’
sprint Unable to detect MPI compiler.
stepR error: ‘ptrdiff_t’ does not name a type.
wand undefined symbol: magic_version.