[R-sig-Debian] Multiple LibPaths in Fresh Install

Dirk Eddelbuettel edd at debian.org
Sat Mar 5 01:54:15 CET 2011


On 4 March 2011 at 19:18, Patrick Richardson wrote:
| Using: natty alpha-2
| 
| Could anyone englighten me (or point me to a self-enlightment page) as
| to why when installing R using:
| 
| > apt-get install revolution-mkl r-revolution-revobase revolution-r r-base-core
| 
| There are 4 library paths available (installed by default):
| 
| > .libPaths()
| [1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"      
| [3] "/usr/lib/R/library"            "/usr/lib64/R/library" 
| 
| I'm wondering why; 1) 4 different librarys are created (i am sure there
| is a good reason, I just don't know what it is).
| 
| 2) Can I consolidate all packages into one library? (my instinct says
| no, and that trying it would break something)
| 
| Any advice (or direction to a "figure it out for yourself" page) would
| be appreciated.

It's scheme once suggested to me by Fritz Leisch and Kurt Hornik of R Core
which has served us all well for eight years. See /etc/R/Renviron for these
comments:

-----------------------------------------------------------------------------
R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/2.12'}
#R_LIBS_USER=${R_LIBS_USER-'~/Library/R/2.12/library'}

# edd Apr 2003  Allow local install in /usr/local, also add a directory for
#               Debian packaged CRAN packages, and finally the default dir 
# edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}
-----------------------------------------------------------------------------

Now, some reasons why the scheme is good:

a) /usr/  !=  /usr/local, and by putting /usr/local first it becomes the
default for R install.packages() etc meaning that R and dpkg / apt-get don't
fight over files (as dpkg et al only use /usr and never, evrt
/usr/local). Very important. Also means local installs get priority which is
robust.

b) It splits /usr/lib/R/site-library off for r-cran-* packages for Debian.

c) It creates /usr/lib/R/library for core R packages. Fritz and Kurt
suggested that.

d) In your list, [3] and [4] are the same thing, there is simply a lib64
symlink so it is really just three.

And as I said, this worked well for thousands of user over an eight year
period.  Suggestions for improvements are of course always welcome.

Hope this helps, Dirk


| 
| Best,
| 
| Patrick
| 
| > sessionInfo()
| R version 2.12.1 (2010-12-16)
| Platform: x86_64-pc-linux-gnu (64-bit)
| 
| locale:
|  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
|  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
|  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
|  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
|  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
| [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base
| 
| _______________________________________________
| R-SIG-Debian mailing list
| R-SIG-Debian at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



More information about the R-SIG-Debian mailing list