Search code examples
rr-caret

Can't load 'Caret' in R


When loading the caret package the following error appears.

> library(caret)
Error: package or namespace load failed for ‘caret’:
 object ‘warnErrList’ is not exported by 'namespace:utils'

Even I tried to install 'caret' with all dependencies, it still shows: object ‘warnErrList’ is not exported by 'namespace:utils'


Solution

  • Xu Gao, it is likely that you are on a version of R prior to 3.5.0. Either you will need to upgrade R, or downgrade whatever package is dependent on it.

    If you read R-devel NEWS, search for warnErrList, and you'll find

    New warnErrList() utility (from package nlme, improved)

    You can back this up by looking at the list of exported functions for utils in R-3.5.0 and you can find warnErrList, whereas utils in R-3.4.3 (the previous release of R), the function cannot be found.

    Unfortunately, I cannot find utils::warnErrList in the caret source directly, which suggests one of its dependencies might be using it and you find out about it late in the game. If you run traceback() immediately after receiving that error, it may provide some insight as to which package is trying to use it. (Some sleuthing will likely be required, searching for function names, even those that are not exported by the intermediate packages.)

    Also, I request that you please submit a caret issue, including the steps necessary to justify the bug. (I could start an issue, but because I have R-3.5.3, caret-6.0.80, and I cannot reproduce the bug ... it could be disingenuous of me to file the bug ... not to mention that I might be completely wrong about this :-)