[R-pkg-devel] Error creating union class: object ‘.__C__compMatrix’ not found

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Mon May 18 20:31:10 CEST 2020


On 29/04/2020 1:16 p.m., renozao wrote:
> Thank you Martin,
> 
> Looks like the mMatrix class defined in Matrix is not exported in 3.6.3, maybe it is now exported in the current R-devel.

Matrix doesn't have the same versions as R:  it's a recommended package, 
not a base package.  It can be updated independently of R.  The current 
version on CRAN is 1.2-18, but the R-forge version is 1.3-0.  Neither 
one exports mMatrix.

Duncan Murdoch

> 
> In this case I'd rather use a conditional import and definition.
> I'll try that route.
> 
> Bests,
> Renaud
> 
> Sent with ProtonMail Secure Email.
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Saturday, April 18, 2020 12:36 PM, Martin Maechler <maechler using stat.math.ethz.ch> wrote:
> 
>>>>>>> renozao
>>>>>>> on Wed, 8 Apr 2020 16:19:59 +0000 writes:
>>
>>> Thank you William for the reproducible example.
>>
>>      > Currently I using the following (same as in William's example):
>>
>>      > setClassUnion("mMatrix", c("Matrix", "matrix"))
>>
>>
>>> Martin, are the changes made in the union class handling affecting the way we should declare them?
>>
>>> Thank you.
>>
>>> Bests,
>>
>>      > Renaud
>>
>>
>> Thank you, Renaud, and Bill Dunlap.
>>
>> There is obviously a bit of a problem there, but it may well be
>> "only" a problem in error handling.
>>
>> As Bill's trace(get, ..) shows, R tries to get
>> "#HAS_DUPLICATE_CLASS_NAMES" which is indeed an indication of the problem:
>>
>> You are trying to REdefine a class union that already exists
>> identically in the Matrix package:
>> In the R-forge development version of 'Matrix', it is
>> line 717 of Matrix/R/AllClass.R (and that will be close also
>> in the CRAN version of Matrix).
>>
>> So at least for you, Renaud, the solution to the problem is easy:
>> Just don't do what you should not do: What you want is already
>> part of Matrix.... and after searching: It's been part of
>> Matrix since ca. July 2012 ...
>>
>> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> But yes, there's a buglet in the 'methods' package currently,
>> which leads to a misleading error message
>> (It's arguable if it should give an error which it did not previously;
>> I think it would be quite a good idea to give at least a
>> warning as you are masking class definition of the Matrix
>> package which is in your search() path or at least among the
>> loaded namespaces at this time).
>>
>> Best,
>> Martin
>>
>>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>>
>>      > On Wednesday, April 8, 2020 11:19 AM, William Dunlap <wdunlap using tibco.com> wrote:
>>
>>
>>>> Use trace() to get a bit more detail - .__C_compMatrix is looked for in the wrong environment with inherits=FALSE.
>>
>>      >>
>>
>>      >>> setClassUnion("mMatrix", c("Matrix", "matrix"))
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".AllMTable", envir="<environment: 0x21dcf10>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".MTable", envir="<environment: 0x2238cf0>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".AllMTable", envir="<environment: 0x21dcf10>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get("#HAS_DUPLICATE_CLASS_NAMES", envir = .classTable) on entry
>>
>>      >> x="#HAS_DUPLICATE_CLASS_NAMES", envir="<environment: 0x2787710>", topenv="<environment: base>", inherits=TRUE
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".AllMTable", envir="<environment: 0x21dcf10>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".MTable", envir="<environment: 0x2238cf0>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".MTable", envir="<environment: 0x21dcf10>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(".SigLength", envir = env) on entry
>>
>>      >> x=".SigLength", envir="<environment: 0x21dcf10>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(".SigLength", envir = env) on entry
>>
>>      >> x=".SigLength", envir="<environment: 0x21dcf10>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(name, envir = env) on entry
>>
>>      >> x=".MTable", envir="<environment: 0x2238cf0>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(".SigLength", envir = env) on entry
>>
>>      >> x=".SigLength", envir="<environment: 0x2238cf0>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(".SigLength", envir = env) on entry
>>
>>      >> x=".SigLength", envir="<environment: 0x2238cf0>", topenv="<environment: namespace:methods>", inherits=TRUE
>>
>>      >> Tracing get(cname, envir = cwhere, inherits = FALSE) on entry
>>
>>      >> x=".__C__compMatrix", envir="<environment: R_GlobalEnv>", topenv="<environment: R_GlobalEnv>", inherits=FALSE
>>
>>      >> Error in get(cname, envir = cwhere, inherits = FALSE) :
>>
>>      >> object '.__C__compMatrix' not found
>>
>>      >> ...
>>
>>      >>
>>
>>      >> Bill Dunlap
>>
>>      >> TIBCO Software
>>
>>      >> wdunlap tibco.com
>>
>>      >>
>>
>>      >> On Wed, Apr 8, 2020 at 7:52 AM William Dunlap <wdunlap using tibco.com> wrote:
>>
>>      >>
>>
>>      >>> % R-devel --vanilla --quiet
>>
>>      >>>> library(Matrix)
>>
>>      >>>> setClassUnion("mMatrix", c("Matrix", "matrix"))
>>
>>      >>> Error in get(cname, envir = cwhere, inherits = FALSE) :
>>
>>      >>> object '.__C__compMatrix' not found
>>
>>      >>> Error in setClassUnion("mMatrix", c("Matrix", "matrix")) :
>>
>>      >>> unable to create union class:  could not set members "Matrix"
>>
>>      >>>> sessionInfo()
>>
>>      >>> R Under development (unstable) (2020-04-07 r78175)
>>
>>      >>> Platform: x86_64-pc-linux-gnu (64-bit)
>>
>>      >>> Running under: Ubuntu 16.04.6 LTS
>>
>>      >>>
>>
>>      >>> Matrix products: default
>>
>>      >>> BLAS/LAPACK: /usr/lib/libopenblasp-r0.2.18.so
>>
>>      >>>
>>
>>      >>> locale:
>>
>>      >>> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>
>>      >>> [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>
>>      >>> [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>
>>      >>> [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>
>>      >>> [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>
>>      >>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>>      >>>
>>
>>      >>> attached base packages:
>>
>>      >>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>>      >>>
>>
>>      >>> other attached packages:
>>
>>      >>> [1] Matrix_1.2-18
>>
>>      >>>
>>
>>      >>> loaded via a namespace (and not attached):
>>
>>      >>> [1] compiler_4.1.0  grid_4.1.0      lattice_0.20-41
>>
>>      >>>
>>
>>      >>> Bill Dunlap
>>
>>      >>> TIBCO Software
>>
>>      >>> wdunlap tibco.com
>>
>>      >>>
>>
>>      >>> On Wed, Apr 8, 2020 at 7:35 AM Martin Maechler <maechler using stat.math.ethz.ch> wrote:
>>
>>      >>>
>>
>>      >>>>>>>>> renozao
>>
>>      >>>>>>>>> on Mon, 30 Mar 2020 21:20:43 +0000 writes:
>>
>>      >>>>
>>
>>      >>>> > Hi,
>>
>>      >>>> > when R CMD check is run under R-devel (2020-03-29 r78108) I get the following error at installation:
>>
>>      >>>>
>>
>>      >>>> > Error in get(cname, envir = cwhere, inherits = FALSE) :
>>
>>      >>>> > object ‘.__C__compMatrix’ not found
>>
>>      >>>> > Error in setClassUnion("mMatrix", c("Matrix", "matrix")) :
>>
>>      >>>> > unable to create union class:  could not set members "Matrix"
>>
>>      >>>>
>>
>>      >>>> > This does not happen on R 3.6.3.
>>
>>      >>>>
>>
>>      >>>> > I tried with Matrix listed in Depends but I still get the same error.
>>
>>      >>>>
>>
>>      >>>> > Is this linked to some changes in union classes or the Matrix package?
>>
>>      >>>>
>>
>>      >>>> > Thank you.
>>
>>      >>>>
>>
>>      >>>> > Bests,
>>
>>      >>>> > Renaud
>>
>>      >>>>
>>
>>      >>>> Hi Renaud,
>>
>>      >>>> One reason you got no response here, is because we don't even
>>
>>      >>>> know about which package you are talking.
>>
>>      >>>>
>>
>>      >>>> So there's nothing, anybody can reproduce from your posting.
>>
>>      >>>>
>>
>>      >>>> There have been changes in R's dealing with class unions etc,
>>
>>      >>>> notably even *relating* to an earlier bug report on class unions
>>
>>      >>>> exactly for such a case which was *triggered* when people built
>>
>>      >>>> on such Matrix classes.
>>
>>      >>>>
>>
>>      >>>> But we would really want to be able to reproduce what you are seeing..
>>
>>      >>>>
>>
>>      >>>> Best regards,
>>
>>      >>>> Martin Maechler
>>
>>      >>>>
>>
>>      >>>> ETH Zurich, R Core Team *and* maintainer("Matrix")
>>
>>      >>>>
>>
>>      >>>> ______________________________________________
>>
>>      >>>> R-package-devel using r-project.org mailing list
>>
>>      >>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>>      > [[alternative HTML version deleted]]
>>
>>
>>> ______________________________________________
>>
>>      > R-package-devel using r-project.org mailing list
>>
>>      > https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



More information about the R-package-devel mailing list