Skip to content

Fix R CMD check on Windows: propagate .libPaths() to PSOCK eFDR workers#50

Open
ZoliQua wants to merge 1 commit into
ELTEbioinformatics:masterfrom
ZoliQua:fix/psock-libpaths-windows-check
Open

Fix R CMD check on Windows: propagate .libPaths() to PSOCK eFDR workers#50
ZoliQua wants to merge 1 commit into
ELTEbioinformatics:masterfrom
ZoliQua:fix/psock-libpaths-windows-check

Conversation

@ZoliQua

@ZoliQua ZoliQua commented Jun 16, 2026

Copy link
Copy Markdown

Problem

set_based_enrichment_test() runs the resampling eFDR on a PSOCK cluster and loads the package on
each worker with clusterEvalQ(cl, library("mulea")). PSOCK workers are fresh R sessions that do
not inherit the parent's .libPaths()
. When mulea is not on a worker's default library tree —
most notably the temporary *.Rcheck library used during R CMD checklibrary("mulea") fails
on the workers and the whole call aborts.

In practice this breaks R CMD check on Windows, where re-building the vignette (mulea.Rmd,
which runs eFDR with nthreads = 2) fails with:

--- re-building 'mulea.Rmd' using rmarkdown
Error in checkForRemoteErrors(...) :
  2 nodes produced errors; first error: there is no package called 'mulea'
--- failed re-building 'mulea.Rmd'
Error: Vignette re-building failed.

Unix workers happen to pick up the check library via the inherited R_LIBS environment, so the
failure is Windows-specific, but the underlying cluster setup is fragile on every platform.

Fix

Capture the host's library paths, export them to the workers, and set them before loading the
package:

worker_libpaths <- .libPaths()
clusterExport(cl, c(..., "worker_libpaths"), envir = environment())
clusterEvalQ(cl, { .libPaths(worker_libpaths); library("mulea") })

One file changed (R/set-based-enrichment-test.r), plus a NEWS.md entry and a patch version bump.

Why it is safe

The change only affects how the workers locate the package. It does not touch the RNG, the
per-thread seeding (seeds_per_thread), the C++ simulation, or any arithmetic, so eFDR results are
unchanged. In normal installed use the workers already resolve library("mulea") via the default
library path, so this is purely a check/build-robustness fix with no behavioural change for users.

Verification

  • On an installed build, ora(..., p_value_adjustment_method = "eFDR", nthreads = 2) runs without
    error and its p_value column is byte-identical to the serial (nthreads = 1) path.
  • The full R-CMD-check matrix now passes on windows-latest (previously failing on the vignette
    rebuild), alongside ubuntu-latest release/devel and macOS.

…fore library(mulea); fixes R CMD check vignette build on Windows. Bump to 1.1.2 + NEWS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant