[Rd] R 2.0.0: namespaces, S4 classes & versioned package installation: failure to resolve correct pkg version

From: Matthias Burger <matthias.burger_at_epigenomics.com>
Date: Thu 07 Oct 2004 - 02:00:44 EST


further down from the problem I asked about yesterday I encounter the following problem (please appologize for the lengthy mail - I have not found a brief example making the issue clear):

Pkgs install ok and the first pkg 'base' can be loaded in R (2.0.0) ok but loading a second pkg 'algo' that defines classes derived from 'base' fails as 'algo' searches for 'base' in the search path without the version extension. The problem does not occur if installed wo --with-package-versions option.

The traceback of the actual call is given below, but there is no simple reproducible example I have come up with yet.

An reproducible case that might be of some help and give some further insights: I installed stats4 from the R-source-tree/src/library with --with-package-versions

In R

[1] ".GlobalEnv"           "package:stats4_2.0.0" "package:stats"
[4] "package:graphics"     "package:grDevices"    "package:RUnit_0.4.0"
[7] "package:methods"      "Autoloads"            "package:base"

carrel>obj <- new("mle")
Loading required package: stats4

Attaching package 'stats4':

         The following object(s) are masked from package:stats4_2.0.0 :


[1] "mle"
[1] "stats4"

as far as i could understand the problem lies in the 'package' attribute not being set to package + version string.

In the call sequence
new -> getClass -> getClassDef: here .requirePackage(package) is called where package is retrieved from package = packageSlot(Class)

Is this speculation correct or did I make a mistake somewhere else? Is there any way to teach methods to look for the classes in the versioned package in the search path?
Or is this just asking more than can be achieved with the current methods implementation?

Any help or suggestion is greatly appreciated.



For ensuring long term reproducible results we so far have used the versioned package maintenance concept and certaily would like to continue doing so.

Loading required package: EpiR.base
Error in as.environment(pkg) : no item called "package:EpiR.base" in the search list In addition: Warning message:
replacing previous import: filter in: namespaceImportFrom(self, asNamespace(ns))

Call Stack:

1 :  library("EpiR.algo_1.4.0")
2 :  try({
3 :  loadNamespace(package, c(which.lib.loc, lib.loc))
4 :  sys.source(codeFile, env, keep.source = keep.source)
5 :  eval(i, envir)
6 :  eval(expr, envir, enclos)
7 :  .defineRankingClass(where = .where)
8 :  setClass("Ranking", representation("VIRTUAL", rowGroup = "Grouping", 
colGroup = "Grouping"), prototype(rowGroup = newGrouping(), colGroup = newGrouping()), vali
9 : makeClassRepresentation(Class, properties, superClasses, prototype, package, validity, access, version, sealed, where = where)
10 :  prototype(rowGroup = newGrouping(), colGroup = newGrouping())
11 :  .prototype(...)
12 :  newGrouping()
13 :  new("Grouping")
14 :  initialize(value, ...)
15 :  initialize(value, ...)
16 :  "@<-"(`*tmp*`, valid, value = TRUE)
17 :  "slot<-"(object, name, TRUE, value)
18 :  checkSlotAssignment(object, name, value)
19 :  getClass(class(obj))
20 :  .requirePackage(package)
21 :  .asEnvironmentPackage(package)

Error in library("EpiR.algo_1.4.0") : package/namespace load failed

info: class Grouping is defined in EpiR.base and used for slot rowGroup, newGrouping is a simple wrapper to new("Grouping") providing some meaningful defaults.

Matthias Burger                     Project Manager/ Biostatistician
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-371                          fax:+49-30-24345-555
http://www.epigenomics.com           matthias.burger_at_epigenomics.com

R-devel@stat.math.ethz.ch mailing list
Received on Thu Oct 07 02:05:50 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:27 EST