Skip to content

furrr with carrier::crate and globals = FALSE has stopped working #280

@alping

Description

@alping

Following the article here https://furrr.futureverse.org/articles/carrier.html, I cannot get furrr to work with carrier::crate and globals = FALSE. This has worked previously, but unfortunately I don't know what has changed (e.g. updated packages). Running the crated function by itself or through furrr with globals = TRUE works. Setting globals = FALSE gives an error.

Tested with R=4.4.1/R=4.5.0, furrr=0.3.1, and carrier=0.1.1.

Code

# From the example in the article

constant <- 1.67

crt5 <- crate(
  constant = constant,
  function(x) {
    x + constant
  }
)

crt5(2:5) # Works

plan(multisession, workers = 2)

opts <- furrr_options(globals = FALSE)

x <- list(1:10, 11:20)

future_map(x, crt5, .options = opts) # Gives error

opts <- furrr_options(globals = TRUE)

future_map(x, crt5, .options = opts) # Works

Error

Error in (function (.x, .f, ..., .progress = FALSE)  :In index: 1.
Caused by error in `...furrr_fn()`:
! object 'constant' not found

Session info

> sessionInfo()
R version 4.5.0 (2025-04-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=English_United Kingdom.utf8 
[2] LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

time zone: Europe/Stockholm
tzcode source: internal

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

other attached packages:
[1] furrr_0.3.1   future_1.40.0 carrier_0.1.1

loaded via a namespace (and not attached):
 [1] digest_0.6.37     codetools_0.2-20  magrittr_2.0.3    parallel_4.5.0
 [5] lifecycle_1.0.4   cli_3.6.5         parallelly_1.43.0 vctrs_0.6.5
 [9] renv_1.1.4        compiler_4.5.0    purrr_1.0.4       globals_0.18.0
[13] tools_4.5.0       listenv_0.9.1     rlang_1.1.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions