futureverse / future

:rocket: R package: future: Unified Parallel and Distributed Processing in R for Everyone
https://future.futureverse.org
955 stars 85 forks source link

Error: `could not find function "makeNode"` #604

Closed kpj closed 2 years ago

kpj commented 2 years ago

Describe the bug When trying to set the plan to multisession, the following error occurs:

Error in makeNode(workers[[ii]], port = port, ..., rank = ii, action = "options",  : 
  could not find function "makeNode"

I was able to fix the error by explicitly setting makeNode = makeNodePSOCK in the function makeClusterPSOCK in the package parallelly after https://github.com/HenrikBengtsson/parallelly/blob/d02e13027e53f1cf4ab195513912cf8777ff8057/R/makeClusterPSOCK.R#L63. But there must be a better solution.

Reproduce example

library(future)
plan(multisession, worker = 4)
## Error in makeNode(workers[[ii]], port = port, ..., rank = ii, action = "options",  :
##   could not find function "makeNode"

Expected behavior I expected the plan to change and no error to occur.

Session information

> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur/Monterey 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] future_1.24.0-9001

loaded via a namespace (and not attached):
[1] compiler_4.1.3    parallelly_1.30.0 tools_4.1.3       parallel_4.1.3
[5] listenv_0.8.0     codetools_0.2-18  digest_0.6.29     globals_0.14.0
> future::futureSessionInfo()
*** Package versions
future 1.24.0.9001, parallelly 1.30.0, parallel 4.1.3, globals 0.14.0, listenv 0.8.0

*** Allocations
availableCores():
system
     8
availableWorkers():
$system
[1] "localhost" "localhost" "localhost" "localhost" "localhost" "localhost"
[7] "localhost" "localhost"

*** Settings
- future.plan=<not set>
- future.fork.multithreading.enable=<not set>
- future.globals.maxSize=<not set>
- future.globals.onReference=<not set>
- future.resolve.recursive=<not set>
- future.rng.onMisuse=<not set>
- future.wait.timeout=<not set>
- future.wait.interval=<not set>
- future.wait.alpha=<not set>
- future.startup.script=<not set>

*** Backends
Number of workers: 8
List of future strategies:
1. multisession:
   - args: function (..., worker = 4, envir = parent.frame(), workers = availableCores())
   - tweaked: TRUE
   - call: plan(multisession, worker = 4)

*** Basic tests
Error in makeNode(workers[[ii]], port = port, ..., rank = ii, action = "options",  :
  could not find function "makeNode"

Funnily enough, the crash also occurs for future::futureSessionInfo().

HenrikBengtsson commented 2 years ago

Hi. Not a bug, but you've got a typo. See https://github.com/HenrikBengtsson/future/discussions/603.

This is the second one in a short time. Are you by any chance following an example online that has these instructions? If so, which?

kpj commented 2 years ago

Ah, thanks a lot for pointing me to the discussion! I only searched for similar issues and did not find anything mentioning makeNode. Using workers instead of worker fixes the issue for me as well.

I checked which examples I looked at the past few days:

But they all either don't mention the workers parameter at all or use the corrected pluralized form. So I think I just read through the documentation too quickly.

HenrikBengtsson commented 2 years ago

Thanks for checking

bbolker commented 5 months ago

For what it's worth, this is an easy typo to make. How hard would it be to write a test to flag it ... ? (I realize that it gets passed down through ... so maybe not so easy)