Download and install R

Version 18.6.0 of IBM® SPSS® Modeler - Essentials for R requires an installation of R. Version 4.4.0, is the only supported version. Install R on the computer where you install IBM SPSS Modeler - Essentials for R.

Prerequisites

The target computer where you install Essentials for R must have X11. If the target computer has a physical display, then it most likely has X11. The steps that follow describe the process for installing X11, if necessary.

  1. Install the X11 client and server
    • For Linux distributions that use yum, install the X11 client and server software with:
      yum groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop" 
      yum update xorg-x11-server-Xorg
      yum install xorg-x11-server-Xvfb.x86_64
    • For Linux distributions that use apt-get, install the X11 client and server software with:
      apt-get install xorg xterm
      apt-get install xsever-xorg xserver-xorg-core xserver-xorg-dev
      apt-get install xvfb
  2. Install openGL
    • For Linux distributions that use yum, install openGL with:
      yum install mesa-libGL-devel mesa-libGLU-devel libpng-devel
    • For Linux distributions that use apt-get, install openGL with:
      apt-get install libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa libglu1-mesa-dev
  3. Start Xvfb. For more information, see http://www.x.org/archive/X11R7.6/doc/man/man1/Xvfb.1.xhtml.
  4. Set the DISPLAY environment variable. The general form for the DISPLAY variable is:
    export DISPLAY=<Hostname>:<D>.<S>
    In the preceding statement, <Hostname> is the name of the computer that hosts the X display server. To specify localhost, omit the value of <Hostname>. <D> is the display number of the Xvfb instance. <S> is the screen number, which is typically 0.
    Note: The DISPLAY environment variable must be set before you start the IBM SPSS Modeler server.
  5. 4.0.4 is the recommended R version. Note that the versions of zlib, bzip2, xz, and pcre that were included with old versions of R have been removed. So if you choose to install R from source, you must install the dependent packages zlib, bzip2, xz, pcre, and curl. You must also set the shared library path by adding the following line to the .bash_profile for the user who runs R or /usr/local/lib/etc/ld.so.conf.
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

    For more information, see the R Installation and Administration manual at https://www.r-project.org/.

    • For Linux distributions that use yum, run the following commands to install packages:
      sudo yum install gcc-gfortran
      sudo yum install readline-devel
      sudo yum install bzip2-devel
      sudo yum install pcre2-devel
      sudo yum install libcurl-devel
      sudo yum install libX11-devel libXt-devel libXext-devel libXmu-devel
      

In addition to installing X11, it is recommended that you install tcl/tk before installing R.

Installing R from a package manager

Your distribution's repository may include R. If so, you can install R using your distribution's standard package manager (such as the RPM Package Manager or the Synaptic Package Manager).

  • For Linux distributions that use yum, you can install R with yum install R.
  • For Linux distributions that use apt-get, you can install R from the command:
    apt-get install r-base=<Version> r-base-core=<Version>  r-base-dev=<Version>

    where <Version> is the name of the version. Note that you might need to update the file /etc/apt/source.list to add new sources.

Building and installing R from source

The source for R is available from https://cran.r-project.org/src/base/R-4/.

  1. Create a temporary directory to decompress and unpack the R source.
    Example:
    mkdir ~/Rsource
  2. Download the source code for building R. For example, R-4.4.0.tar.gz, and save it to the temporary directory.
  3. Change to the temporary directory.
    Example:
    cd ~/Rsource
  4. Decompress and unpack the R source to the temporary directory.
    Example:
    chmod a+x R-4.4.0.tar.gz 
    tar -xzvf R-4.4.0.tar.gz
    
  5. Change to the source directory.
    cd R-4.4.0 
    Note: To install R to the default directory, you must run the following step as root, either by logging in as root or using the sudo command. Read the information in doc/html/R-admin.html (located under the directory where you unpacked the R source) before you proceed with configuring, building and installing R.
  6. Run the following commands to specify necessary compiler settings (see the special settings for PowerLinux):
    export CC="gcc -m64" 
    export CXXFLAGS="-m64 -O2 -g" 
    export FFLAGS="-m64 -O2 -g" 
    export FCFLAGS="-m64 -O2 -g" 
    export LDFLAGS="-L/usr/local/lib64" 
    export LIBnn=lib
    

    PowerLinux settings:

    export CC="<XLC_PATH>/bin/xlc_r -q64"
    export CFLAGS="-g -O2 -qstrict -qfloat=nomaf:fenv"
    export F77="<XLF_PATH>/xlf_r -q64"
    export FFLAGS="-g -O3 -qstrict -qfloat=nomaf:fenv -qextname"
    export CXX="<XLC_PATH>/bin/xlC_r -q64"
    export CPICFLAGS=-qpic
    export CXXPICFLAGS=-qpic
    export FPICFLAGS=-qpic
    export SHLIB_LDFLAGS=-qmkshrobj
    export SHLIB_CXXLDFLAGS=-G
    export FC="<XLF_PATH>/xlf_r -q64"
    export FCFLAGS="-g -O3 -qstrict -qfloat=nomaf:fenv -qextname"
    export FCPICFLAGS=-qpic
    export CXX1XSTD=-qlanglvl=extended0x

    Where <XLC_PATH> and <XLF_PATH> are the locations of IBM XL C/C++ for Linux and IBM XL Fortran for Linux respectively.

    If installing R on PowerLinux P8LE servers (Ubuntu or RedHat), you must install the XL C/C++ Compiler and the XL Fortran Compiler (16.1.1.12 or later).

  7. Run the following commands to install the prerequisite build tools.
    sudo yum install gcc-gfortran
    sudo yum install readline-devel
    sudo yum install bzip2-devel
    sudo yum install pcre2-devel
    sudo yum install libcurl-devel
    sudo yum install libX11-devel libXt-devel libXext-devel libXmu-devel
    
  8. Configure, build, and install R. Make sure that you configure R with the arguments: --enable-R-shlib and --with-x. For example, run the following command in a command prompt (see the special settings for PowerLinux):
    ./configure --enable-R-shlib --with-x && make && make install

    PowerLinux settings:

    ./configure --enable-R-shlib --with-x --with-readline=no --disable-openmp&& gmake && gmake install

    For details about building R on IBM z Systems, see https://github.com/linux-on-ibm-z/docs/wiki/Building-R.

  9. Check the R version to verify the installation.
    R –version
Note: The readline entry is optional, depending on how your system is configured.