简体   繁体   中英

worker initialization failed: there is no package in parallel processing

I'm trying to parallelise a function in R using the R function focal_hpc from the 'spatial.tools' R package. I'm using this script in a SLURM server. This is an example of what I have run.

f_mean = function(x){mean(x)}

sfQuickInit(cpus=6)
res_mean<-focal_hpc(x=raster,fun=f_mean,window_dims=c(7,7))[[1]]
sfQuickStop()

However, I do get the following error and I do not understand why:

Error in e$fun(obj, substitute(ex), parent.frame(), e$data) : 
  worker initialization failed: there is no package called ‘spatial.tools’
Calls: system.time ... focal_hpc_focal_processing -> %dopar% -> <Anonymous>

I have installed the 'spatial.tools' package in a local library within the server, so my guess is that the function is not able to load the package from the local library.

What do you think?

Are you able to load the spatial.tools package from a compute node? You should try by allocating compute resources with the command salloc and then start R and try to see if you can load the package spatial.tools . Whatever you install you need to make sure that all the compute nodes have access (read access at least) to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM