[R-sig-Debian] installing/updating R packages: apt-get vs. install.packages() and .libPaths()

Dirk Eddelbuettel edd at debian.org
Sun Mar 12 18:51:24 CET 2006


Michael,

I just had to approve another post of yours ....

On 12 March 2006 at 12:13, Michael Friendly wrote:
| 
| 
| Dirk Eddelbuettel wrote:
| 
| > [ Delayed, and the manually approved as Michael posted without being
| >   subscribed under this address. Please consider subscribing.  --Dirk ]
| 
| [I've subscribed 3 times, always with the same outgoing email address
| > Your subscription request has been received, and will soon be acted upon. Depending on the configuration of this mailing list, your subscription request may have to be first confirmed by you via email, or approved by the list moderator. If confirmation is required, you will soon get a confirmation email which contains further instructions.
| 
| But I never get a confirmation, or the digest postings I requested.]

I would take that to mean that you never got the subscription finalised. It
works with a handshake mechanism via email. Maybe York U blocked the reply,
maybe your spam filter ate it. I do not know.  I can however confirm that
'friendly at yorku.ca' is not shown as a list member.

So I just subscribed you manually.  Obviously, this doesn't scale well and I
do not intend to offer that service for everybody who fails to subscribe
manually.

| Aparently, I wasn't the only one confused:
| Jeremy wrote:
| > I couldn't find anything on the R FAQ's mentioning Debian
| > specifically.  And a simple search for 'upgrade' in the FAQ also
| > turned up nothing.  I even used Google to search for a way to upgrade
| > R using CRAN, with no relevant results.  After a little bit of
| > searching around the CRAN site I found this :
| > 
| > http://cran.r-project.org/bin/linux/debian/README
| > 
| > Which was all the information I needed.  Thanks for all the help.
| > 
| > Jeremy

That is an unrelated issue of someone failing to read the FAQ. I see no point
in bringing it up here, really.

| [I think the point here was not that debian didn't appear in the FAQ,
| but rather that the information there was not sufficiently detailed.]
| 
| I would recommend the following:
| 
| 1) In the R-FAQ, add the the lines:

For matters related to the FAQ, please email Kurt.Hornik at R-Project.org about
this (and I will CC him now). I have no influence on the R FAQ. I merely run
two R-related lists per an invitation by Martin M., and maintain a number of
Debian R packages.

| More details on installing and administering R on debian linux may be
| found at
| 
|      <link>http://cran.r-project.org/bin/linux/debian/README</link>
| 
| 2) Add a section to the above README along the following lines of:
| (feel free to edit in any way)

I think for changes to the README, a diff or a new version emailed to
cran at r-project.org is the best way to go about it.
 
| * DEBIAN ADMINISTRATION AND MAINTENANCE
| 
| The recommended policy for installing and maintaining R on debian linux 
| is as follows:
| 
|     *  The r-base-core and r-recommended debian packages are normally 
| installed and updated using apt-get (as root) to /usr/lib/R/library.
| 
|     *  Other debian packages (e.g., r-cran-*) are normally installed and 
| updated using apt-get (as root) to /usr/lib/R/site-library.
| 
|     *  Still other packages may be installed by the local user/admin
| from source or using install.packeges() to 
| /usr/local/lib/R/site-library/.  This depends on local policy and 
| setting the proper permissions.
| 
|     *  Users are always free to install packages in $HOME/lib/R/library
| (or elsewhere).  This requires adding any such library to the .lib.paths
| list, e.g., in .Rprofile ...
| 
| > 
| > |  I'm confused about where things go based on apt-get install 
| > | {r-base,r-cran}* vs install.packages()
| > | and whether I am running as root vs me.  If I want to update.packages() 
| > | I don't want to have
| > | to worry about whether I am currently root or me -- I just want to be 
| > | *me* and have it work.
| > 
| > That works _provided you prepare your territory__. This is unix, so "you"
| > can only write there if your root let's you write. So you could for example
| > 
| > i)   add yourself to group adm in /etc/groups
| > ii)  chgrp adm /usr/local/lib/R/site-library/
| > iii) chmod g+w /usr/local/lib/R/site-library/
| > 
| > Now you should be able to say (inside R) 
| > 
| > 	> update.packages(lib.loc="/usr/local/lib/R/site-library/")
| 
| OK, but implicit in my original post was the question of what happens 
| when there are packages to be upgraded in more than one library.  If I

I think you should strive to not install more than once. One would have to
see what R does if confronted with several instances of the same package
(possibly in several versions).

Gregor posted a script to test for this too.

| specify lib.loc="/usr/local/lib/R/site-library/", then, presumably the
| r-cran-* packages will be upgraded there, rather than in 
| /usr/lib/R/site-library vs. upgrading with apt-get.   The help for 
| update.packages is mute on what happens when lib.loc=NULL.
| 
|   lib.loc: character vector describing the location of R library trees
|            to search through (and update packages therein).
| 
| 
| 
| > In fact, I just did that.  You may need ii) and iii) with an added -R so that
| > you are allowed to overwrite previously installed versions, if any:
| > 
| > iv)  chgrp -R adm /usr/local/lib/R/site-library/
| > v)   chmod -R g+w /usr/local/lib/R/site-library/
| > 
| > |  > .libPaths()
| > | [1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"
| > | [3] "/usr/lib/R/library"
| > |  >
| > | 
| > | "/usr/lib/R/library"   for apt-get install r-base, as root
| > 
| > Per a suggestion by Fritz and Kurt at one of the Vienna conferences, this
| > directory is reserved for everything from r-base-core and r-recommended (ie
| > boot, MASS, ...) and *nothing* else. So these would get updated via apt-get
| > and dpkg.
| > 
| > | "/usr/lib/R/site-library"    for apt-get install r-cran, as root
| > 
| > Per a suggestion by Fritz and Kurt at one of the Vienna conferences, this
| > directory is reserved for whatever R packages _Debian_ adds to the system.
| > So these would get updated via apt-get and dpkg as well.
| > 
| > | "/usr/local/lib/R/site-library"   for install.packages() as {me,root}
| > 
| > Per a suggestion by Fritz and Kurt at one of the Vienna conferences, this
| > directory is reserved for whatever the local user/admin installs.  I used to
| > do that as root, but the method I suggest above is actually nicer.  So yes,
| > you can do that provided you (as root) give yourself (as you) the proper
| > permissions.
| > 
| > | My machine is single user; should I just give myself chmod g+w privs 
| > | under  /usr/lib/R/site-library
| > | and maybe /usr/lib/R/library?  What is the recommended discipline?
| > 
| > Only for /usr/local/lib/R/ as you need root permissions (or at least sudo) to
| > interact with apt-get / dpkg anyway.
| > 
| > I hope this is of help and wasn;t too terse.  We should expand this where
| > needed and maybe post it on the R Wiki or maybe even polish it up for a quick
| > one-pager in R News...
| 
| This was certainly helpful.  Yes, something on the R Wiki or R News 
| would be useful.

Could you possibly volunteer to edit the Wiki along these lines?  That is a
file that is open to all of us, so we should use it.

Hope this helps,  Dirk

| > Best regards,  Dirk
| > 
| 
| -- 
| Michael Friendly     Email: friendly AT yorku DOT ca
| Professor, Psychology Dept.
| York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
| 4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
| Toronto, ONT  M3J 1P3 CANADA

-- 
Hell, there are no rules here - we're trying to accomplish something. 
                                                  -- Thomas A. Edison



More information about the R-SIG-Debian mailing list