Seira
Seira

Reputation: 21

File not found error when running Maxent in biomod2

When I run Maxent into biomod2 I got this error:

Error in file(file, "rt") : cannot open the connection

In addition: Warning messages:

1: running command 'java' had status 1 
2: In file(file, "rt") :
  cannot open file 'Sargassum.muticum.42.1.25.30/models/sstrange_sstmax_parmean_salinity/Sargassum.muticum.42.1.25.30_AllData_RUN1_MAXENT.Phillips_outputs/Sargassum.muticum.42.1.25.30_AllData_RUN1_Pred_swd.csv': No such file or directory

I've followed the steps of http://modata.ceoe.udel.edu/dev/dhaulsee/class_rcode/r_pkgmanuals/MAXENT4R_directions.pdf to add the java path and maxent.jar directory is copied in the working directory and no spaces are in the path.

When I type

file.exists("maxent.jar")

I get TRUE value.

These are my options:

model <- biomod2::BIOMOD_Modeling(formatdata                                   ,models=c("GLM","MAXENT.Phillips","RF","SRE")                                      ,models.eval.meth=c('KAPPA', 'TSS', 'ROC')                                      ,models.options = biomod_options('C:/Users/me/maxent.jar')                                      ,SaveObj = TRUE,do.full.models = FALSE                                      ,NbRunEval=1,DataSplitTable=dataSplitTable                                    ,VarImport=3,modeling.id = gsub("BO_", "", paste0(layers, collapse= "_")))

Upvotes: 2

Views: 633

Answers (2)

m10
m10

Reputation: 9

My path have not as well any space in the path, so my advise i the following:

put:

myBiomodOptions <- BIOMOD_ModelingOptions(MAXENT = list(path_to_maxent.jar = "your_path"))

and then specificy the modeling options as following:

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

Upvotes: 0

jemand-r
jemand-r

Reputation: 11

I had the same issue and the solution presented here solved my problem: Error running maxent from within biomod2 in R

In short, your path to the maxent.jar should not contain any spaces.

Upvotes: 1

Related Questions