[R] Installing different R versions

Loris Bennett loris.bennett at fu-berlin.de
Thu Oct 8 14:21:41 CEST 2015


Martin Maechler <maechler at stat.math.ethz.ch> writes:

>>>>>> Loris Bennett <loris.bennett at fu-berlin.de>
>>>>>>     on Thu, 8 Oct 2015 12:07:20 +0200 writes:
>
>     > Dear Luca, Luca Cerone <luca.cerone at gmail.com> writes:
>
>     >> Dear Loris and Wolfgang, thanks a lot for the help!
>     >> 
>     >> I wasn't aware of the module project. I'd rather use the
>     >> "official" way of having co-existent R versions in this
>     >> case, but is a good tool to know!
>
>     > As far as I can tell from a quick look, "R Installation
>     > and Administration", as referred to by Wolfgang, just
>     > tells you how to install different versions in different
>     > places by using the configuration option --prefix (for
>     > Linux at least).  This is some thing you always have to
>     > do, if you want to install several versions in parallel.
>
>     > However, once you have multiple versions installed, you
>     > need a mechanism to allow users to choose between them.
>     > This is where Environment Modules come in.  At the
>     > simplest level, they just allow environment variables to
>     > be set and unset in an easy and consistent way.
>
>     > So it is not a question of "using the 'official' way of
>     > having co-existent R versions", but rather of installing
>     > various versions and then enabling people to choose easily
>     > between them.
>
>     > Or have I missed some intrinsic feature of R which will
>     > allow me to switch between installed versions without
>     > having to explicitly tweak environment variables?
>
> Yes, you have missed something.
> I have installed many dozen versions of R simultaneously both at
> work and on my laptop ... all under Linux.
> (Yes, I am extreme - as R Core member wanting to be able to go
>  back and see ...)
>
> I don't need any environment variables, but just symbolic links
> to define 'R', 'R-devel', 'R-patched', 'R-3.2.2', etc etc. in
> our default PATH.
> So these work from the shell (or similar), and 
> even ESS (Emacs Speaks Statistics) is automagically picking up
> all these, so I can use
>    M-x R
>    M-x R-3.2.2
>    M-x R-devel
>    etc
>    
> to have different versions of R running simultaneously "inside" ESS.

Well, I'm not sure I would consider symbolic links to be an "intrinsic
feature of R" that I have missed.

In a module file I would do, say,

set             root          /nfs/software/R/$version
setenv          R_HOME        $root/lib64/R
prepend-path    PATH          $root/bin

Whilst in many cases setting $R_HOME or $R_PROFILE may not be necessary,
if they are needed, then this becomes a great deal easier with a
mechanism such a environment modules.

Another advantage of environment modules is that, if you compile R
against an external library, such as Intel's MKL or an MPI library, you
can also set up the necessary variables and paths via the module files.

However, in general the modules approach is probably only worthwhile if
you have a lot of software in a lot of different versions, which I do.

Cheers,

Loris

-- 
This signature is currently under construction.



More information about the R-help mailing list