Skip to content

package installation order

9 messages · Kuhn, Max, Dirk Eddelbuettel, Brian Ripley +1 more

#
I have roughly 80 or so packages sources. These were obtained by taking
a snapshot of certain CRAN packages a few months ago using 

   install.packages(
      pkgs = pckNames,
      destdir = "/home/max",
      repos = "http://cran.r-project.org"
      dependencies = c("Depends", "Imports", "Suggests"))

We need to install these versions of the packages across a few different
architectures/systems (linux, solaris, 32- and 64-bit). Right now, we
are constrained to version 2.5.1 (I know, I know). 

Right now, I'd use 

   tarList <- list.files()
   tarList <- grep(".tar.gz", tarList, fixed = TRUE, value = TRUE)
   install.packages (tarList, repos = NULL)
	
to install, but the package dependencies are ignored. For example, XML
gets installed after other packages that depend on it.

I've looked through ?install.packages and I have tried using 

   install.packages (
      tarList, repos = NULL, 
      dependencies = c("Depends", "Imports", "Suggests"))

but this did not appear to change the install ordering. 

Is there a simpler way to do this rather than trial and error?

Thanks,

Max
R version 2.5.1 (2007-06-27) 
i686-pc-linux-gnu 

locale:
C

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"
"methods"  
[7] "base"
#
Hi Max,
On 14 November 2007 at 09:34, Kuhn, Max wrote:
| I have roughly 80 or so packages sources. These were obtained by taking
| a snapshot of certain CRAN packages a few months ago using 
| 
|    install.packages(
|       pkgs = pckNames,
|       destdir = "/home/max",
|       repos = "http://cran.r-project.org"
|       dependencies = c("Depends", "Imports", "Suggests"))
| 
| We need to install these versions of the packages across a few different
| architectures/systems (linux, solaris, 32- and 64-bit). Right now, we
| are constrained to version 2.5.1 (I know, I know). 
| 
| Right now, I'd use 
| 
|    tarList <- list.files()
|    tarList <- grep(".tar.gz", tarList, fixed = TRUE, value = TRUE)
|    install.packages (tarList, repos = NULL)
| 	
| to install, but the package dependencies are ignored. For example, XML
| gets installed after other packages that depend on it.
| 
| I've looked through ?install.packages and I have tried using 
| 
|    install.packages (
|       tarList, repos = NULL, 
|       dependencies = c("Depends", "Imports", "Suggests"))
| 
| but this did not appear to change the install ordering. 
| 
| Is there a simpler way to do this rather than trial and error?

When trying to package the by-now-gargantuan Rmetrics for Debian (which is
still ongoing), I looked around for some Depends builders. Turns out that
BioC has this.   E.g. the following worked for:

## > install.packages("Biobase", repo="http://www.bioconductor.org")
## > repos <- Biobase:::biocReposList()
## > install.packages("pkgDepTools", repos=repos["bioc"])
## > library(pkgDepTools)
## Loading required package: graph
## Loading required package: RBGL
## > CRANdeps <- makeDepGraph(repos["cran"], type="source")
## > getInstallOrder("Rmetrics", CRANdeps, needed.only=FALSE)

worked for me.  I meant to add some code for Graphviz visualization (or look
for it, Seth et al probably already wrote it) but what you get from
getInstallOrder() should suit your needs here.

Hth, Dirk
#
On Wed, 14 Nov 2007, Kuhn, Max wrote:

            
You need the information from available.packages() to do the ordering, so 
you need a non-NULL repository.  This works if you convert your local 
collection into a local repository. You will need a PACKAGES file, but 
tools::write_PACKAGES can re-create one for you.

There are also dependency tools in package tools and on BioC.

  
    
#
Dirk,

Thanks for the email.
(which is
that
(or look
That should approximate it. The dependencies for some packages will have
changed since my snapshot. Next time I'll get the CRAN dependencies when
I get the packages.

Max
#
Professor Ripley,
so
This is probably a better option for me given that my source files are a
little out of date. I couldn't get it to work though.

I put the tar.gz files into a sub-directory (./src/contrib)

I ran write_PACAKGES referencing that directory and type = "source" and
verbose = TRUE. No error messages were given and it resulted in PACKAGES
and PACKAGES.gz files that appeared to have all the right info in it.

I figured out the package names by parsing the names of the tar.gz
files.

I then ran 

   install.packages(pckList[1:3],
      repos = "/home/max/tmp/r-2.5.1-pkgs-updated/src/contrib",
      contriburl = "/home/max/tmp/r-2.5.1-pkgs-updated/src/contrib",
      type = "source")

No packages were installed and I had the warnings:

Warning: unable to access index for repository
/home/max/tmp/r-2.5.1-pkgs-updated/src/contrib
Warning message:
packages 'Cairo', 'Design', 'ElemStatLearn' are not available in:
install.packages(pckList[1:3], repos =
"/home/max/tmp/r-2.5.1-pkgs-updated/src/contrib",  

(those particular packages are in ./src/contrib.) I also tried different
variations of using the file names etc.

I'm assuming that I don't have a proper repository. Am I missing
something obvious here and/or is there some documentation on what the
elements of a repository are?

Thanks again,

Max
#
On Wed, 14 Nov 2007, Kuhn, Max wrote:

            
It does say 'URL(s)', hence

repos = "file:///home/max/tmp/r-2.5.1-pkgs-updated"

is I think all you need.  Here's a (working) example local to me:
There is, in the R-admin manual.

  
    
#
Professor Ripley,
That works. Thanks for your expertise.

Max
#
Dirk Eddelbuettel <edd at debian.org> writes:
makeDepGraph returns a graphNEL instance and Rgraphviz knows how to
plot those.  The entire graph will likely not produce a particularly
compelling visualization.  But you can subset the graph according to a
particular package's dependencies, etc.

+ seth
4 days later
#
On 14 November 2007 at 20:38, Seth Falcon wrote:
| Dirk Eddelbuettel <edd at debian.org> writes:
| > When trying to package the by-now-gargantuan Rmetrics for Debian (which is
| > still ongoing), I looked around for some Depends builders. Turns out that
| > BioC has this.   E.g. the following worked for:
| >
| > ## > install.packages("Biobase", repo="http://www.bioconductor.org")
| > ## > repos <- Biobase:::biocReposList()
| > ## > install.packages("pkgDepTools", repos=repos["bioc"])
| > ## > library(pkgDepTools)
| > ## Loading required package: graph
| > ## Loading required package: RBGL
| > ## > CRANdeps <- makeDepGraph(repos["cran"], type="source")
| > ## > getInstallOrder("Rmetrics", CRANdeps, needed.only=FALSE)
| >
| > worked for me.  I meant to add some code for Graphviz visualization (or look
| > for it, Seth et al probably already wrote it) but what you get from
| > getInstallOrder() should suit your needs here.
| 
| makeDepGraph returns a graphNEL instance and Rgraphviz knows how to
| plot those.  The entire graph will likely not produce a particularly
| compelling visualization.  But you can subset the graph according to a
| particular package's dependencies, etc.

Yes indeed!!  That was pretty straightforward just by following some code
inside getInstallOrder. And using "twopi" is good enough for the 40-some
packages in the graph.

But now I need the icing on the cake:  Given such a dependency graph, how can
I color further subgraphs according to some criterion: I'd love to select a
sub-list (of, say, new packages, or of packages that satisfy some other
criterion) and have their node plotted in a different color.   The help pages
clearly indicate that this should be possible, but they are also a little
terse on how one would do this...   Any pointers anywhere?

Dirk