From tplate at acm.org  Tue Mar 25 22:08:01 2008
From: tplate at acm.org (Tony Plate)
Date: Tue, 25 Mar 2008 15:08:01 -0600
Subject: [Rd] problem with 'install.packages'
In-Reply-To: <47E6A242.4000602@pdf.com>
References: <47E6A242.4000602@pdf.com>
Message-ID: <47E969B1.9030409@acm.org>

I'm also interested in a solution to this problem of how to update R 
packages without disturbing sessions that may be using them.

For S-PLUS I've been successfully using a system that always creates a 
new directory for an update of a library, eg., there could be multiple 
directories mylib.c0, mylib.c1, mylib.c2, etc.  A single file contains 
the current mapping with lines like "mylib: mylib.c2".  When a new 
library is published, the mapping file is updated.  When a library is 
attached, the custom "attach" function consults the mapping file to find 
the latest version.  This means that different sessions could have 
different versions of the library attached depending on when they 
attached it, and no in-use library will be overwritten.  Obsolete unused 
version of libraries can be cleaned out periodically.

I've been wondering whether "versioned installs" of packages could be 
used to achieve the same goals in R, e.g., with a system to 
automatically bump the third number in the version on each re-install.  
Could this work?  I read that "versioned installs" are not widely used 
and should be used with caution, and notes like "NB: versioned installs 
are not installs of a named package." in ?install.packages make me wary.

-- Tony Plate

Spencer Graves wrote:
> Hi, All: 
>
>       Is there a way to identify whether any users are using a 
> particular package in a shared network R installation? 
>
>       I ask, because we have such a multiple-user installation and when 
> I tried to install a package using Rgui that was in use by Rterm on a 
> single-user installation, 'install.packages' deleted the existing 
> package but failed to install the new version;  see below. 
>
>       I'm concerned especially about the following multiple user 
> scenario:  User A on terminalServer1 tries "install.packages('mvtnorm')" 
> when user B on terminalServer2 was using 'mvtnorm';  both are using the 
> same network installation.  If the results match my experience on a 
> single-user installation, the existing version will be deleted but the 
> new version will NOT be installed.  Any subsequent new attempt to access 
> 'mvtnorm' will fail until all current users of 'mvtnorm' quit those 
> sessions and someone subsequently invokes 
> "install.packages('mvtnorm')".  In fact, user B could have disconnected 
> from that session a month ago, and may have long forgotten the R session 
> that is still officially active, though perhaps consuming 0 CPU seconds 
> in the past month! 
>
>       Thanks,
>       Spencer
> #######################################
> ##
> ## Rgui
> ##
> #######################################
> R version 2.6.2 (2008-02-08)
> <snip>
>  > utils:::menuInstallPkgs()
> trying URL 
> 'http://cran.cnr.berkeley.edu/bin/windows/contrib/2.6/mvtnorm_0.8-3.zip'
> Content type 'application/zip' length 214769 bytes (209 Kb)
> opened URL
> downloaded 209 Kb
>
> package 'mvtnorm' successfully unpacked and MD5 sums checked
> Warning: cannot remove prior installation of package 'mvtnorm'
>
> The downloaded packages are in
>         C:\Documents and Settings\spencerg\Local 
> Settings\Temp\RtmpghgskA\downloaded_packages
> updating HTML package descriptions
>  > library(mvtnorm)
> Error in library(mvtnorm) : there is no package called 'mvtnorm'
>
>  > sessionInfo()
> R version 2.6.2 (2008-02-08)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
> States.1252;LC_MONETARY=English_United 
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base    
>
> loaded via a namespace (and not attached):
> Error in x[["Version"]] : subscript out of bounds
> In addition: Warning message:
> In FUN(c("mvtnorm", "tools")[[2L]], ...) :
>   DESCRIPTION file of package 'mvtnorm' is missing or broken
>  >
> #######################################
> ##
> ## Concurrent Rterm session
> ##
> #######################################
> R version 2.6.2 (2008-02-08)
>
> <snip>
>
>  > dmvnorm(1:2)
> [1] 0.01306423
> [1] ".GlobalEnv"        "package:mvtnorm"   "package:stats"   
>  [4] "package:graphics"  "package:grDevices" "package:utils"   
>  [7] "package:datasets"  "package:methods"   "Autoloads"       
> [10] "package:base"    
>  > detach()
>  > dmvnorm(1:2)
> Error: could not find function "dmvnorm"
>  > library(mvtnorm)
> Error in library(mvtnorm) : there is no package called 'mvtnorm'
>  > sessionInfo()
> R version 2.6.2 (2008-02-08)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
> States.1252;LC_MONETARY=English_United 
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base    
>
> loaded via a namespace (and not attached):
> Error in x[["Version"]] : subscript out of bounds
> In addition: Warning message:
> In FUN(c("mvtnorm", "stepAICc")[[2L]], ...) :
>   DESCRIPTION file of package 'mvtnorm' is missing or broken
>  >
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



[Rd] problem with 'install.packages'
Tony Plate