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

Chris Evans chrishold at psyctc.org
Wed Sep 21 08:49:30 CEST 2011

Dirk Eddelbuettel sent the following at 20/09/11 21:37:
> Welcome!

> On 20 September 2011 at 21:20, Chris Evans wrote:
> | I am moving from windoze on a Dell laptop to Debian but I seem to have
> | hit a snag for R.  I managed to find the information to point an
> | /etc/apt/sources.list entry at my local CRAN repository and have
> | installed R 2.13.1 for squeeze from the Bristol UK repository.
> Good so far.
> | I  installed a number of the additional R packages using synaptic which
> | reported no errors but when I run my first update.packages() as an
> | ordinary user I get this:
> *Every* interaction with the package management system in Debian or Ubuntu
> has to happen as root.  So do NOT say 'synaptic', say 'sudo synaptic'.

I ran synaptic from the Debian application menu which defaults to root 
after askling for the root password the first time I invoke it after a 
reboot. (I probably should have said that I've been using Debian for my 
internet server work for about 15 years: I'm not a Debian/linux newbie, 
just someone finally throwing away the reins from M$ to have a laptop 
running Debian as well!)
> | The downloaded packages are in
> | 	‘/tmp/Rtmp9LYziU/downloaded_packages’
> | Warning in install.packages(update[instlib == l, "Package"], l,
> | contriburl = contriburl,  :
> |    'lib = "/usr/lib/R/library"' is not writable
> | Error in install.packages(update[instlib == l, "Package"], l, contriburl
> | = contriburl,  :
> |    unable to install packages
> | In addition: Warning messages:
> | 1: In install.packages(update[instlib == l, "Package"], l, contriburl =
> | contriburl,  :
> |    installation of package 'rgl' had non-zero exit status
> | 2: In install.packages(update[instlib == l, "Package"], l, contriburl =
> | contriburl,  :
> |    installation of package 'XML' had non-zero exit status
> If you get this, and think you used synaptic, you're confused.

Perhaps but not how you think (I think!: just not clear in what I said.

I get that from invoking update.packages() in an R session launched from 
a user (chris) terminal session. Before that I had done an install of 
2.13.1 from synaptic calling r-cran-base and then finding R worked and 
then running synaptic again and getting those additional debs I wanted 
from the ones you packaged and the Bristol CRAN repository provided 
(r-cran-abind, r-cran-amelia, and others).

> Synaptic gets you prebuilt binaries from the repos it knows about.
> What you show here is local compilation, possibly triggered by R. Not at all
> the same.
Agree and sorry I wasn't clear.
> | Although all the compilations have run through, presumably with errors
> | for rgl and XML, clearly the "not writable" status of /usr/lib/R/library
> Both r-cran-rgl and r-cran-xml exists _as pre-built binaries_. See above, do
> not build them locally unless you have to AND know how to.

I wouldn't dream of compiling locally anything I can get from a deb you 
> | has genuinely prevented the update.
> |
> | I thought I'd seen strong advice here recently against updating
> | libraries as root so I'm intrigued about this.  Can someone advise me
> | what I should do?
> |
> | Thanks in advance and huge thanks to all who do the porting to Debian
> | and generally make R so good.
> It works actually really well indeed, but it is still on Linux / Unix --
> which is a whole new world onto itself for people just joining.  As the joke
> goes: "Unix is user-friendly, but it is picky about its friends."

I like that phrase, hadn't heard it: nice. I do try to adapt to its 
demands and be a good friend and in 15 years have virtually never found 
it truly whimsical, it's usaully got a reason it doesn't like you even 
if it doesn't always tell you clearly what you did to offend!
> Is there a local user group or a colleague you could bug locally?
Good question, in 15 years I haven't needed that but if someone on the 
list knows of them I could explore that.

However, I come back to feeling that there must be three separate 
problems here that come from within the packages I added after the 
initial r-cran-base install. My hunch is that there are things with XML 
and rgl that I will be able to track down when restrict to just updating 
them but that at the moment there is a more global problem which I'm 
guessing is caused by one package overriding the order of library path 
options seen in .libPaths() which starts with a perfectly writable local 
user directory and I am guessing there is some way that package has 
insisted that the install tries /usr/lib/R/library.

I don't know enough about the way that R and linux work agree the use of 
those library location options. From ?.libPaths and a bit more hunting 
around the R help I had the impression that the .libPath options would 
be used in order. I think I can remove the /usr ones by hacking in 
/etc/R but that presumably risks losing access to the main libraries 
that will have been installed there so that doesn't look a good step 
forward except perhaps to debug things.

I suspect that I could do a complete remove of all of R, start again 
installing r-cran-base, check that R installed by that updates fine run 
by a user and then I could use synaptic to add the additional deb 
packages you provide but doing that one by one and running R and 
update.packages() after each one to see if I don't hit this until afetr 
a particular deb but that's going to take quite a long time so I 
wondered if you or the list had quicker suggestions to debug this.

Sorry for length but hope that's clearer (got to try to be an acceptable 
friend on R lists as well as with linux and I really, really do 
appreciate the generosity of this list).


Chris Evans<chris at psyctc.org>  Skype: chris-psyctc
Consultant Psychiatrist in Psychotherapy, Notts. PDD network;
Professor, Psychotherapy, Nottingham University
*If I am writing from one of those roles, it will be clear. Otherwise*
*my views are my own and not representative of those institutions    *
If you have difficulty Emailing me on this address or getting a reply,
send again but cc to:       chris dot evans at nottshc dot nhs dot uk
and to:                     c dot evans at nottingham dot ac dot uk

More information about the R-SIG-Debian mailing list