Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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.

I think that if there is no debian repo that provides multiple versions, it is hard to keep two versions of R running smoothly without compiling R from source.

What I often do is install R in my home dir as our institute does not give us root privileges. To install a source version of R systemwide, you could install this in a separate directory (e.g. /opt/R2.14) and use:

./configure --prefix=/opt/R2.14/

The final step is to create a symbolic link to the R binary:

ln -s /opt/R2.14/bin/R /usr/bin/R2.14

Users can than start two versions of R (R and R2.14). Hope this helps!

It's true that building R from source is very very easy (even I can do it!), as long as you know the following command to run first :

apt-get build-dep r-base

otherwise you might get missing library type errors from make. Thanks to Dirk posting that gem in the past. I haven't seen that in the manual, README or FAQ.

Then, it's just :

./configure
make

I suppose this might be a consideration for you then: does R use static or dynamic system libraries? Might a self-built R link to different libraries than the pre-packaged binary R? (I don't know). How much you go into that depends on how critical your application of R is I guess and which system libraries are critical to you.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top