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

jranke at uni-bremen.de jranke at uni-bremen.de
Tue Sep 20 23:41:43 CEST 2011

Dear Chris, Dirk, dear list,

let me add some thoughts here:

Zitat von Dirk Eddelbuettel <edd at debian.org>:
> 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.

So you are using the R binary packages I am maintaining for CRAN.

> | 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:

As Dirk pointed out, updating packages from within R under Linux/Unix  
requires a bit more than under Windows. However it is not a black art.  
Basically you need to have r-base-dev installed plus development  
packages for any libraries your R package is linking against.

> *Every* interaction with the package management system in Debian or Ubuntu
> has to happen as root.  So do NOT say 'synaptic', say 'sudo synaptic'.

@Dirk: He said he used update.packages() as an ordinary user.

> | 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.
> Synaptic gets you prebuilt binaries from the repos it knows about.

It seems to me that Chris has r-cran-rgl and r-cran-xml from Debian  
squeeze, and R 2.13.1 from CRAN.

> What you show here is local compilation, possibly triggered by R. Not at all
> the same.
> | 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 agree that I would not recommend upgrading them if there is no good  
reason for doing so.

> | 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."
> Is there a local user group or a colleague you could bug locally?

If you really want to upgrade R packages like rgl and XML that are  
available in Debian, I would recommend to do it the Debian way. This  
means adding the unstable sources to your /etc/apt/sources.list,  
running as root (using aptitude/apt as I am not familiar with synaptic)

     aptitude build-dep r-cran-rgl r-cran-xml

which gets build dependencies, then as a normal user go to some  
location where you want to build, i.e. ~/tmp and

     apt-get source -b r-cran-rgl r-cran-xml

You will find, if all goes well, updated .deb packages in your working  
directory that you can then install (again as root) e.g. using dpkg -i.

In this way you do not mix the packaging systems of Debian and R.

If you really want to do regular upgrades of all packages from within  
R (even though you decided to use Debian stable), you can get the  
build dependencies as above, but I believe Dirk would agree it would  
be better to remove the Debian packages first and then install R  
packages from within R in the first place.

Kind regards,


> Dirk
> | Chris
> |
> | --
> | 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
> |
> | _______________________________________________
> | R-SIG-Debian mailing list
> | R-SIG-Debian at r-project.org
> | https://stat.ethz.ch/mailman/listinfo/r-sig-debian
> --
> New Rcpp master class for R and C++ integration is scheduled for
> San Francisco (Oct 8), more details / reg.info available at
> http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
> _______________________________________________
> R-SIG-Debian mailing list
> R-SIG-Debian at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-debian

More information about the R-SIG-Debian mailing list