How to install 2 different R versions on Debian?

前端 未结 4 2106
遇见更好的自我
遇见更好的自我 2020-12-16 16:48

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 c

相关标签:
4条回答
  • 2020-12-16 17:17

    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.

    0 讨论(0)
  • 2020-12-16 17:32

    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.

    0 讨论(0)
  • 2020-12-16 17:32

    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.

    0 讨论(0)
  • 2020-12-16 17:40

    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!

    0 讨论(0)
提交回复
热议问题