Open HenrikBengtsson opened 3 years ago
Ah, here's a smaller example:
$ R_FUTURE_PLAN=future.callr::callr Rscript --vanilla -e "loadNamespace('future')"
Error: .onLoad failed in loadNamespace() for 'future', details:
call: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
error: cyclic namespace dependency detected when loading ‘future’, already loading ‘future.callr’, ‘future’
Execution halted
and
$ R_FUTURE_PLAN=future.callr::callr R --quiet --vanilla
> loadNamespace("future")
Error: .onLoad failed in loadNamespace() for 'future', details:
call: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
error: cyclic namespace dependency detected when loading ‘future’, already loading ‘future.callr’, ‘future’
> traceback()
3: stop(gettextf("%s failed in %s() for '%s', details:\n call: %s\n error: %s",
hookname, "loadNamespace", pkgname, deparse(conditionCall(res))[1L],
conditionMessage(res)), call. = FALSE, domain = NA)
2: runHook(".onLoad", env, package.lib, package)
1: loadNamespace("future")
To work around this, the future plan needs to be deferred to later (after the future package is loaded).
$ R_FUTURE_DEBUG=true R_FUTURE_PLAN=future.callr::callr Rscript --vanilla -e "loadNamespace('future')"
...
[21:53:56.218] parallelly-specific environment variables:
- R_FUTURE_DEBUG=‘true’
- R_FUTURE_PLAN=‘future.callr::callr’
[21:53:56.231] Future-specific environment variables:
- R_FUTURE_DEBUG=‘true’
- R_FUTURE_PLAN=‘future.callr::callr’
...
[21:53:56.235] Environment variable ‘R_FUTURE_GLOBALS_KEEPWHERE’ not set
[21:53:56.237] Option 'future.plan' = ‘future.callr::callr’
[21:53:56.237] R process uuid: cc462a76-6aa8-84ca-8578-752f3cab43ca
[21:53:56.237] Setting plan('default')
Error: .onLoad failed in loadNamespace() for 'future', details:
call: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
error: cyclic namespace dependency detected when loading ‘future’, already loading ‘future.callr’, ‘future’
Execution halted
Issue
Action
Have
.onLoad()
detect whenR CMD build
is running and unsetR_FUTURE_PLAN
.