From Luc.Menut at supagro.inra.fr  Wed Jun 18 23:40:31 2008
From: Luc.Menut at supagro.inra.fr (Luc Menut)
Date: Wed, 18 Jun 2008 23:40:31 +0200
Subject: [Rd] problem with personal library (R_LIBS_USER) when R_LIBS is
 defined (patch)
Message-ID: <485980CF.801@supagro.inra.fr>

As from R 2.5.0 users can install packages in their home directories, in 
directory specified by the environment variable R_LIBS_USER. It's a 
great feature.
But I have a problem with this feature, when R_LIBS is defined.
It works well the first time, when R creates the directory defined in 
R_LIBS_USER.

 > install.packages('BayesTree')
Warning in install.packages("BayesTree") :
   argument 'lib' is missing: using '/usr/lib64/R/lib'
Warning in install.packages("BayesTree") :
   'lib = "/usr/lib64/R/lib"' is not writable
Would you like to create a personal library
'~/R/x86_64-mandriva-linux-gnu-library/2.7'
to install packages into?  (y/n) y
.....
 > q()

But if you close R, then launch R again, R fails to reuse this directory 
(R_LIBS_USER) to install another package, because the directories 
defined in R_LIBS are in first in the libPaths (and it fails if R_LIBS 
isn't writable by user).

 > .libPaths()
[1] "/usr/lib64/R/lib"
[2] "/home/menut/R/x86_64-mandriva-linux-gnu-library/2.7"
[3] "/usr/lib64/R/library"

 > install.packages('BayesValidate')
Warning in install.packages("BayesValidate") :
   argument 'lib' is missing: using '/usr/lib64/R/lib'
Warning in install.packages("BayesValidate") :
   'lib = "/usr/lib64/R/lib"' is not writable
Error in install.packages("BayesValidate") : unable to install packages

I attach a patch, which try to reuse existing user directory R_LIBS_USER 
(tested under Linux).
with this patch
 > .libPaths()
[1] "/usr/lib64/R/lib"
[2] "/home/menut/R/x86_64-mandriva-linux-gnu-library/2.7"
[3] "/usr/lib64/R/library"
 > install.packages('BayesValidate')
Warning in install.packages("BayesValidate") :
   argument 'lib' is missing: using '/usr/lib64/R/lib'
Warning in install.packages("BayesValidate") :
   'lib = "/usr/lib64/R/lib"' is not writable
Warning in install.packages("BayesValidate") :
   using '~/R/x86_64-mandriva-linux-gnu-library/2.7'
...


Please could you review it and tell me if such things are worth 
including into upstream version.

Best regards,
Luc

-- 
Luc MENUT
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: R-2.7.0-install_packages-R_LIBS_USER-fix.patch
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20080618/17c7248b/attachment.pl>


[Rd] problem with personal library (R_LIBS_USER) when R_LIBS is defined (patch)
Luc Menut