Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install 2 different R versions on Debian?

On our server, R 2.12.1 is installed following the instructions on http://cran.r-project.org/bin/linux/debian/ , using apt-get install etc etc.

Due to circumstances the old lenny machine hasn't been updated to the new stable debian, and it looks like this isn't about to happen soon. As some of the research here depends on the latest version of VGAM, we need the R 2.14.0 installed on debian. But in order to keep old code running, we can't just drop the R 2.12.1 (installing the VGAM 0.8.4 on this version gives errors).

So we need to install 2 R-versions. From the little I understood, if we just use apt-get upgrade the old version will be replaced by the new. I've been going through heaps of documentation, but I can't find the optimal way of doing so.

The only thing I could imagine now, is to try to build the latest R from source, but my colleagues were not very keen on that idea and prompted me to first look for another solution. Any info I missed, or is somebody willing to show me the little trick to get this done? If building from source is the solution, I'd like to hear about any pitfalls or possible problems.

like image 544
Joris Meys Avatar asked Dec 01 '11 15:12

Joris Meys


People also ask

Can I have 2 versions of R installed?

You can support multiple versions of R concurrently by building R from source. Plan to install a new version of R at least once per year on your servers.

Do I need to uninstall R before installing new version?

To Upgrade your R EnvironmentUninstall the old version of R. Uninstalling R removes files from the initial installation, but not packages that have been installed or updated. See the third-party R documentation for steps to uninstall R for your machine configuration. Install the new version of R from CRAN.

Do I need to install both R and RStudio?

R and R Studio are separate packages. You will need to install R first. R is the basic package we are using. R Studio is an add-on that make R easier to use for beginners.


2 Answers

As I mentioned in comments, this is theoretically possible just like some package families (Emacs, PostgreSQL, ...) allow multiple concurrent versions.

I cannot offer that right now as we use /usr/{share,lib}/R which conflicts. If I were to make that /usr/{share,lib}/R-$version and then use dpkg-alternatives to flip to a default preferred one, we could possibly do it. The problem is the transition. This feature is used by a minority of user, getting to it may introduce bugs for a majority til this is stable. Plus, I do not have the spare time (but if someone else wants to do it, please do so).

In the meantime, you can

  1. possibly use an advanced feature of dpkg and unpack to a local directory rather the default below / -- so /opt/R/oldversions/2.12.1 should be possible. R could even run, you need to redefine $RHOME accordingly.

  2. just build local variants into /usr/local if you really must

  3. if a particular CRAN / non-CRAN package claims to need a particular version of R, fix the damn package already! ;-)

Finally, this is a topic for r-sig-debian as eg the CRAN maintainer Michael and Johannes won't read this thread here.

like image 52
Dirk Eddelbuettel Avatar answered Oct 24 '22 07:10

Dirk Eddelbuettel


You can install different versions of ANY software using proper compile flags. When you run the configure script with --help you should see an option to see the install root.

Take a look at

./configure --help
...
Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]

so you could install R-2.14 to:

/usr/local/R/2.14

and you could install R-2.12 to:

/usr/local/R/2.12

when you launch the configure script do:

./configure --prefix=/usr/local/R/2.14

and so on.

like image 34
oz123 Avatar answered Oct 24 '22 05:10

oz123