1

I am developing a package that suggests R's parallel package (So my DESCRIPTION has a Suggests: parallel (>= 1.13.1) statement. It compiles fine under OSX and Linux but fails when building on windows (using win-builder). Here is the end of the install.log that win-builder spits out:

*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'spectrolab' in 
library.dynam(lib, package, package.lib):
DLL 'parallel' not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'd:/RCompile/CRANguest/R-devel/lib/spectrolab'

Find the full output from win-builder here https://win-builder.r-project.org/4k9QC0st397H/

There is only one function that tries to use parallel. It goes more or less like this:

#' Smooth spline functions for spectra
#' ... roxygen stuff ...
#' @importFrom stats smooth.spline
#' @importFrom parallel detectCores mclapply
smooth.spectra = function(x, ...){

  p = requireNamespace("parallel", quietly = TRUE) && .Platform$OS.type != "windows"

  if(p){
     r = parallel::mclapply(x, stats::smooth.spline)
  } else {
     r = lapply(x, stats::smooth.spline)
  }
  r
}

Any ideas of what the problem is?

dudu
  • 675
  • 6
  • 15

2 Answers2

2

It's most likely a win-builder hiccup. I've just recently observed the same on CRAN Windows tests (same setup as win-builder) for no good reasons:

https://www.r-project.org/nosvn/R.check/r-devel-windows-ix86+x86_64/doFuture-00install.html

Unless win-builder maintainer (Uwe Ligges) gets to it himself, you could drop him an email.

HenrikB
  • 6,132
  • 31
  • 34
  • A much more relevant answer than mine in hindsight – CPak Sep 14 '17 at 01:42
  • Also, there was a major update to *R-devel* yesterday related to new ALTREP causing internal SEXP header to change size. This will force *everyone* to reinstall all R packages that use compiled code - otherwise they'll fail one way or the other. I've heard CRAN is in the process of rebuilding all 11,000+ packages(!). Maybe this is also why we see this. – HenrikB Sep 14 '17 at 02:32
  • Could be. It seems that the 'parallel' package / namespace isn't available in the win-builder server. I got the package to compile when I removed all mentions to 'parallel' in NAMESPACE, and also got rid of the roxygen entry #' importFrom parallel detectCores mclapply` – dudu Sep 14 '17 at 14:29
  • This seems to have been fixed; try to resubmit again. (You shouldn't have to avoid `parallel` because of this). – HenrikB Sep 15 '17 at 04:37
0

The problem could be that this package uses mclapply

r = parallel::mclapply(x, stats::smooth.spline)

mcapply only works under doMC

The doMC package acts as an interface between foreach and the multicore functionality of the parallel package, originally written by Simon Urbanek and incorporated into parallel for R2.14.0. The multicore functionality currently only works with operating systems that support the fork system call (which means that Windows isn't supported)

mclapply is under the parallel universe, but

The doParallel package is a merger of doSNOW and doMC, much as parallel is a merger of snow and multicore.

CPak
  • 13,260
  • 3
  • 30
  • 48
  • I may be missing something. `mclapply` is under the `parallel` namespace right? And I am also testing if `parallel` is available, so that shouldn't be the issue – dudu Sep 13 '17 at 21:22
  • This is the cause of much confusion and consternation. See my edited answer. – CPak Sep 13 '17 at 21:23
  • I see my question wasn't clear. I am the developer of the package in question, and I am running in trouble when trying to submit it to CRAN because it fails to compile on windows. I'll give `doParallel` a try and send it to win-builder again. more soon... – dudu Sep 13 '17 at 21:29