[Rd] trouble with package loading: Function found when exporting methods from the namespace ‘raster’ which is not S4 generic: ‘all.equal’
Patrick Giraudoux
p@tr|ck@g|r@udoux @end|ng |rom un|v-|comte@|r
Sun Jan 30 18:52:51 CET 2022
Dear listers,
After having exchanged on the R-package-devel using r-project.org list, I feel
that the question should now be adressed on the R developper list.
You'll find below the trouble I met, and one of the answers that Zhian
Kamvar has been kind enough to provide.
Il looks like the origin might be found in the way R deploys methods and
namespace is managed, which is by far out my skills...
Suspect some bug somewhere (?)
Best,
Patrick
------------------------------------------------------------------------
THE PROBLEM
One user (in cc) has signaled a problem installing the package pgirmess
(version 1.7.1 on CRAN), with this message on loading:
> library(pgirmess)
Error: package or namespace load failed for ‘pgirmess’:
Function found when exporting methods from the namespace ‘raster’ which
is not S4 generic: ‘all.equal’
In addition: Warning message:
no function found corresponding to methods exports from ‘raster’ for:
‘direction’, ‘gridDistance’
I cannot identify where the trouble comes from since:
- pgirmess goes through OK in all the checks on CRAN
- I can install/remove it with correct loading on my own platform
(Windows 10)
- pgirmess 1.7.1 does not import 'raster' and the functions mentioned above
The user has installed the last R version on Windows. However, she gets
a correct loading only if she loads 'Matrix' before (or 'lme4' - but to
my knowlege, lme4 actually loads Matrix).
She meets also the same issue with pgirmess 2.0 (not on CRAN yet, see
https://github.com/pgiraudoux/pgirmess however this version (still on
test) has deprecated/dropped all functions related to dealing with rasters.
This occurs in R directly (not necessarily within RStudio).
On the web, Iook likes this issue has is already been spotted for some
other packages (e.g. mapview, tmap, etc.). Checking help-lists I saw
that installing rtools might solve the problem (e.g.
https://community.rstudio.com/t/error-package-or-namespace-load-failed-for-mapview/126914)
however, it seems to me a strange workaround since rtools should not be
made necessary for lay R user (not developers).
Best,
------------------------------------------------------------------------
ZHIAN's ANSWER
Le 28/01/2022 à 17:35, Zhian Kamvar wrote :
I've run into deep dependencies registering methods that mess things up
before: https://github.com/thibautjombart/adegenet/issues/308.
AFAICT, it has something to do with the way R deploys methods where they
can be available if the namespace is available. In this case, it's via
spdep -> spData -> raster. That being said, I am NOT an expert on this
and would like to know more if anyone has better insight.
[[alternative HTML version deleted]]
More information about the R-devel
mailing list