Skip to content
Prev 1678 / 3656 Next

update.packages() as ordinary user, /usr/lib/R/site-library is not writable

Huge thanks to Johannes (sorry, Johannes, I think I implied that Dirk 
was doing all the hard work in rolling things in my earlier reply, the 
"you" is plural!)

What I've done:
A) removed r-cran-rgl and r-cran-xml using synaptic as root
B) re-entered new R session as user chris, confirmed that the packages 
had gone using installed.packages() and grep()!
C) ran "adduser chris staff" as root
D) logged off gnome session (ah, that bit's a pain when making group 
membership changes which won't otherwise propagate to current session!)
E) logged back in!
F) checked I was now member of staff: yes!
G) checked I can write to /usr/local/lib/R/site-library: yes!
H) ran R as user chris ... now it gets interesting and frustrating:
     no damn joy, update.packages and selecting only abind to update 
without specifying instlib says it runs fine but next time I run 
update.packages it still shows the old version and wants to do the 
update again so I
I) (and this was a debugging mistake for which I apologise) did the same 
but specifying instlib as /usr/local ... and it runs fine again (this 
time I checked that it had updated in /usr/local/... and there it was in 
solitary splendour as my first updated library/package there) ... but  ...
J) that hasn't gained me anything (I suspect the previous update without 
the "instlib=" may have been fine too) as update.packages still wants to 
update it ...
K) so I get thoughtful: clearly update.packages is reading from /usr/lib 
not /usr/local ...
L) so I check .libPaths():
 > .libPaths()
[1] "/home/chris/R/i486-pc-linux-gnu-library/2.13"
[2] "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"
[4] "/usr/lib/R/library"
M) Hm.  Looks good to me but I see Dirk is telling me /usr/local/... 
should be first so I go to /etc/R/Renviron and I find:
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}
and nothing I can see in Renviron.site that would override that.

I _THINK_ I see a logic:  installation is happening "first come, first 
used" on the libPaths but update.packages() is reading from all the 
library locations and the later are overriting the earlier ... that 
would explain things but surely it would mean that no-one, including 
Dirk, would be able to run update.packages() successfully as a non-root 
user.

So now I'm baffled as to how to be friendly with R and linux/Debian on 
this machine!

Perhaps I should say that I would like to work by:
1) having the cran deb line in /etc/apt/sources.list and doing basic 
installation of R from there as my understanding is that that will get 
me the latest R for Debian when you (plural) have rolled it and put it 
on CRAN getting me round the downloading and replacing I used to do on 
windoze and also making it pretty likely that you'll have sorted out 
dependency problems etc.
2) would like then to rely on update.packages() from within R
3) but running as local user as I can see the logic of that

#1 and #2 are what I've always done on my Debian web server (where I was 
running some cgi-bin scripts invoking R) but I always did the 
update.packages() as root.  I've now moved that server to a shell 
account at mythic-beasts (great guys) so I'll have to do #3 for that too 
in future and though I could update as root on this laptop I do see the 
logic of not doing that and clearly you both and presumably many others 
on this list do #1, #2 and #3 so why is it not working for me?!

Suggestions gratefully received!

Very best & karma to all,

Chris



Dirk Eddelbuettel sent the following  at 21/09/11 13:49: