Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[statet-users] external pointer is not valid error with terra package

Hello all,


when using the "terra" package, I still get "external pointer is not valid" errors, now with the new version of StatET (4.9) , Eclipse 2023-12 and R 4.3.3. As "terra" is now the standard package for the analysis of spatial data, I would be happy if this can be resolved or for a workaround:

> library(terra)
terra 1.7.71
> f <- system.file("ex/elev.tif", package="terra")
> r <- rast(f)
Fehler: external pointer is not valid
Fehler: external pointer is not valid
Fehler: external pointer is not valid
...
> print("hello")
[1] "hello"
Fehler: external pointer is not valid
Fehler: external pointer is not valid
>

It seems to be related to the scanning of the objects in the "Object Browser". Everything works fine again, when the object "r" is removed. 

> remove(r)
>

Regards,

Marco


-----Ursprüngliche Nachricht-----
Von: Hofmann, Marco 
Gesendet: Samstag, 14. Januar 2023 14:01
An: Statet user discussions <statet-users@xxxxxxxxxxx>
Betreff: external pointer is not valid error with terra package

Hello all,

I get " external pointer is not valid" error messages when using the "terra" package. As the problems do not occur in a normal RGui, I wonder if this is related to StatET?

Here is the code (a command from the "rast" help page and a traceback() ):

> library(terra)
terra 1.6.17
> x <- rast(nrows=108, ncols=21, xmin=0, xmax=10)
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
> traceback()
3: stop(structure(list(message = "external pointer is not valid", 
       call = (new("activeBindingFunction", .Data = function (x) 
       {
           if (missing(x)) 
               .Call(list(name = "CppField__get", address = <pointer: 0x000001c6f2619cf0>, 
                   dll = list(name = "Rcpp", path = "C:/Program Files/R/R-4.2.1/library/Rcpp/libs/x64/Rcpp.dll", 
                     dynamicLookup = TRUE, handle = <pointer: 0x00007ff9e3700000>, 
                     info = <pointer: 0x000001c6f51f2f20>), numParameters = 3L), 
                   <pointer: 0x000001c6f3dad5a0>, <pointer: 0x000001c6f6acb9c0>, 
                   .pointer)
           else .Call(list(name = "CppField__set", address = <pointer: 0x000001c6f26195b0>, 
               dll = list(name = "Rcpp", path = "C:/Program Files/R/R-4.2.1/library/Rcpp/libs/x64/Rcpp.dll", 
                   dynamicLookup = TRUE, handle = <pointer: 0x00007ff9e3700000>, 
                   info = <pointer: 0x000001c6f51f2f20>), numParameters = 4L), 
               <pointer: 0x000001c6f3dad5a0>, <pointer: 0x000001c6f6acb9c0>, 
               .pointer, x)
       }))(), cppstack = NULL), class = c("Rcpp::exception", "C++Error", 
   "error", "condition")))
2: .Call(structure(list(name = "CppField__get", address = <pointer: 0x000001c6f2619cf0>, 
       dll = structure(list(name = "Rcpp", path = "C:/Program Files/R/R-4.2.1/library/Rcpp/libs/x64/Rcpp.dll", 
           dynamicLookup = TRUE, handle = <pointer: 0x00007ff9e3700000>, 
           info = <pointer: 0x000001c6f51f2f20>), class = "DLLInfo"), 
       numParameters = 3L), class = c("CallRoutine", "NativeSymbolInfo"
   )), <pointer: 0x000001c6f3dad5a0>, <pointer: 0x000001c6f6acb9c0>, 
       .pointer)
1: (new("activeBindingFunction", .Data = function (x) 
   {
       if (missing(x)) 
           .Call(list(name = "CppField__get", address = <pointer: 0x000001c6f2619cf0>, 
               dll = list(name = "Rcpp", path = "C:/Program Files/R/R-4.2.1/library/Rcpp/libs/x64/Rcpp.dll", 
                   dynamicLookup = TRUE, handle = <pointer: 0x00007ff9e3700000>, 
                   info = <pointer: 0x000001c6f51f2f20>), numParameters = 3L), 
               <pointer: 0x000001c6f3dad5a0>, <pointer: 0x000001c6f6acb9c0>, 
               .pointer)
       else .Call(list(name = "CppField__set", address = <pointer: 0x000001c6f26195b0>, 
           dll = list(name = "Rcpp", path = "C:/Program Files/R/R-4.2.1/library/Rcpp/libs/x64/Rcpp.dll", 
               dynamicLookup = TRUE, handle = <pointer: 0x00007ff9e3700000>, 
               info = <pointer: 0x000001c6f51f2f20>), numParameters = 4L), 
           <pointer: 0x000001c6f3dad5a0>, <pointer: 0x000001c6f6acb9c0>, 
           .pointer, x)
   }))()
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
>

Afterwards the error messages where even thrown when just hitting return in the Console:

> 
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
Fehler in (new("activeBindingFunction", .Data = function (x)  : 
  external pointer is not valid
>

Here are some installation details:
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Eclipse IDE for Java Developers	4.26.0.20221201-1200
StatET IDE for R  (Incubation) 4.6.0.202209080600-r

Windows 10 Pro Version	21H2

Is this a problem specific for my installation or is it more general?
I would be happy if this could be solved, as I want to migrate from the "raster" to the "terra" package.

Kind regards,
Marco

Back to the top