biomodhub / biomod2

BIOMOD is a computer platform for ensemble forecasting of species distributions, enabling the treatment of a range of methodological uncertainties in models and the examination of species-environment relationships.
90 stars 22 forks source link

Error in BIOMOD__Modeling - Error in { : task 8 failed - "cannot open the connection" / "MAXENT_outputs/maxent.stderr': Permission denied" #538

Open Friepei opened 2 weeks ago

Friepei commented 2 weeks ago

Error and context

I wanted to run another model because I had new occurence points, however I run into problems, that I didnt have before (about 2-3 months ago). Yesteraday, I updated Biomod2, Maxent and Java, however it did not fix the problem.

myBiomodData <- BIOMOD_FormatingData(resp.var = myResp, expl.var = myExpl, resp.xy = myRespCoord, resp.name = myRespName, PA.strategy = 'user.defined', PA.user.table = myabs, )

myBiomodModelOut <- BIOMOD_Modeling(bm.format = myBiomodData, modeling.id = 'AllModels',
CV.strategy = 'random', CV.nb.rep = 2, CV.perc = 0.8, OPT.strategy = 'bigboss', metric.eval = c('TSS','ROC'), var.import = 2, seed.val = 42)

Output: Error in { : task 8 failed - "cannot open the connection" In addition: Warning messages: 1: In .bm_ModelingOptions.check.args(data.type = data.type, models = models, : Only one GAM model can be activated. 'GAM.mgcv.gam' has been set (other available : 'GAM.gam.gam' or 'GAM.mgcv.bam') 2: glm.fit: Adjusted probabilities with numerical value 0 or 1 occurred 3: In file(con, "r") : cannot open file './Rclavata/models/AllModels/Rclavata_PA1_RUN1_MAXENT_outputs/maxent.stderr': Permission denied 4: glm.fit: Adjusted probabilities with numerical value 0 or 1 occurred 5: glm.fit: Adjusted probabilities with numerical value 0 or 1 occurred 6: glm.fit: Adjusted probabilities with numerical value 0 or 1 occurred

Friepei commented 2 weeks ago

When I use this lines after the Biomod_Modeling command,

cl <- makeCluster(2)

registerDoParallel(cl)

on.exit(stopCluster(cl))

I still get the error message: Warning message: In .bm_ModelingOptions.check.args(data.type = data.type, models = models, : Only one GAM model can be activated. 'GAM.mgcv.gam' has been set (other available : 'GAM.gam.gam' or 'GAM.mgcv.bam')

and the evaluation values and projections still do not make sense.

MayaGueguen commented 1 week ago

Hello Fredi,

Glad to see that you find the commands closing cluster : it is exactly what we would have recommended to try for this kind of error 👍

Tell me if I'm wrong, but it seems that it solved the error, yes ?

ℹ️ The message you still get is not an error, but a warning message : we have several algorithms available to the user for the GAM model, and it just informs you which one has been selected by default.

As for the evaluation and projection values, this is another thing, that might be depending on your data (but not necessarily on a biomod2 error).

Maya

Friepei commented 1 week ago

Thank you for the reply. Now I have received another error ...

Error and context Creating suitable Workdir... Error in { : task 1 failed - "NULL value passed as symbol address"

Code used to get the error myBiomodEMProj <- BIOMOD_EnsembleForecasting( bm.em = myBiomodEM, bm.proj = myBiomodProj, models.chosen = "all", metric.binary = "TSS",
compress = 'xy', output.format = '.tif', clamping.mask = T, do.stack=T )

MayaGueguen commented 1 week ago

Hello there,

It seems to me that it should come from things that got mixed... :grimacing: Could you try and restart your session, be sure to clean everything properly, and restart from the beginning using the cluster commands ? :eyes:

Maya

Friepei commented 13 hours ago

Hi Maya,

For the moment, I can run the models if I restart R after running the myBiomodProj and then continue with my original script. However, for species with a lot of presences (>10 000) projected habitat suitability lies below 0.5 for the whole region. When I ran the model a few months ago before all the issues, it gave me much higher values.