Rainer M Krug
2009-Feb-27 07:34 UTC
[R] Installing different versions of R simultaneously on Linux
Hi I want to install some versions of R simultaneously from source on a computer (running Linux). Some programs have an option to specify a suffix for the executable (eg R would become R-2.7.2 when the suffix is specified as "-2.7.2"). I did not find this option for R - did I overlook it? If it is not, how is it possible to have several versions of R on one computer, or is the only way to compile them and then call R in the directory of the version where it was compiled (~/R-2.7.2/bin/R)? If this is the case, would it be possible to add this o[ptiuon to specify the suffix for the executables? Thanks Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Faculty of Science Natural Sciences Building Private Bag X1 University of Stellenbosch Matieland 7602 South Africa
Berwin A Turlach
2009-Feb-27 08:41 UTC
[R] Installing different versions of R simultaneously on Linux
G'day Rainer, On Fri, 27 Feb 2009 09:34:11 +0200 Rainer M Krug <r.m.krug at gmail.com> wrote:> I want to install some versions of R simultaneously from source on a > computer (running Linux). [...]What flavour of Linux are we talking about?> If it is not, how is it possible to have several versions of R on one > computer, or is the only way to compile them and then call R in the > directory of the version where it was compiled (~/R-2.7.2/bin/R)?For Debian based machines (I first used Debian, nowadays Kubuntu), I got into the following habit: 1) Unpack the R sources in /opt/src 2) Enter /opt/src/R-x.y.z and run configure with --prefix=/opt/R/R-x.y.z (and other options) 3) Build R with checks and documentation from source and install. 4) Run in /opt/src a script that uses "update-alternative" install to install the new version and creates a link from /opt/R/R-x.y.z/bin/R to /opt/bin/R-x.y.z I have /opt in my PATH, thus I can call any R version explicitly by R-x.y.z. Typing R alone, will usually start the most recently installed version (as this will have the highest priority) but I can configure that via "sudo update-alternatives --config R". I.e., I can make R run a particular version. Since the "update-alternative" step above also registers all the *.info files and man pages, I will also access the documentation of that particular R version (e.g., C-h i in emacs will give me access to the info version of the manuals of the version of R which is run by the R command). Over time, typically when the linux system is upgraded, libraries on which old R-x.y.z binaries relied vanish. At that time I usually delete /opt/R/R-x.y.z and remove that version from the available alternatives. HTH. Let me know if you need more details. Cheers, Berwin
Prof Brian Ripley
2009-Feb-27 10:37 UTC
[R] Installing different versions of R simultaneously on Linux
This is really an R-devel question. On Fri, 27 Feb 2009, Rainer M Krug wrote:> Hi > > I want to install some versions of R simultaneously from source on a > computer (running Linux). Some programs have an option to specify a > suffix for the executable (eg R would become R-2.7.2 when the suffix > is specified as "-2.7.2"). I did not find this option for R - did I > overlook it? > > If it is not, how is it possible to have several versions of R on one > computer, or is the only way to compile them and then call R in the > directory of the version where it was compiled (~/R-2.7.2/bin/R)? > > If this is the case, would it be possible to add this o[ptiuon to > specify the suffix for the executables?'R' is not an executable, but a shell script. You can use 'prefix' to install R anywhere, or other variables for more precise control (see the R-admin manual). For example, we use rhome to have R 2.8.x under /usr/local/lib64/R-2.8 etc. And you can rename $prefix/bin/R to, say, R-2.7.2, or link R_HOME/bin/R to anywhere in yout path, under any name you choose.> > Thanks > > Rainer > -- > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation > Biology, UCT), Dipl. Phys. (Germany) > > Centre of Excellence for Invasion Biology > Faculty of Science > Natural Sciences Building > Private Bag X1 > University of Stellenbosch > Matieland 7602 > South Africa-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595