New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in BIOMOD_Modeling - [MaxEnt error in file] #341
Comments
Hello JY Xie, Thank you for reporting 🙏 Could you try changing your BIOMOD_FormatingData command by this please ?
It seems Maya |
Maya, Thank you for your prompt reply! According to your advising, I just have tried the method, but it seem to not work with the same error above, do you have any other suggestion? Indeed, I have tried on two computer, so it should not be responsible for computer or file name. JY XIE #######################Format sdm data for biomod2 #######################Defining Models Options using default options ####################Constrcut sdm models by setting parameters |
Thank you for trying 🙏 Could you try and check into your files browser if the files mentioned really exist or not ? |
the files "D:/Rtry/SDM/maxent.jar" & "D:/Rtry/SDM/" both exist, In addition, It's interesting, my error was: but there exist a file named "Pred_swd.csv" in the path(my species name is "Bandicota.bengalensis.mach.1"): D:\Rtry\SDM\Bandicota.bengalensis.mach.1\models\1696860853\Bandicota.bengalensis.mach.1_allData_RUN1_MAXENT_outputs\Predictions\Pred_swd.csv. I guess the file bring the bug to me. it make me fell confused, the file is generated by my codes, why they can't found it? |
Huuum it is not the same path in the error message :
and in your folder :
The numbers do not match. You can give a |
Thanks for your reminding! Try starting again from a blank repository seem have no impact on my error, so , it's really a headache problem! |
Hello, the maintenance team of Biomod2:
I'm a ecological doctor. recently, I was working with biomod2 to finish my project, but meet some troubles which beyond my ability to solve. So can you help me?
Error and context
When I run Maxent in biomod2, I meet the error, although I have tried many solutions which other people have solved their similar problems, but they didn't work with my code. I have tried to change the file path of maxent.jar to without any spaces or change the system environmental variables(followed: http://modata.ceoe.udel.edu/dev/dhaulsee/class_rcode/r_pkgmanuals/MAXENT4R_directions.pdf), but they don't help me for my trouble.
Code used to get the error
#######################Format sdm data for biomod2
Sp.biomod.data = BIOMOD_FormatingData(resp.name = Resp.name,
resp.var = Resp.vector,
expl.var = Sdm.env,
resp.xy = Resp.coor,
na.rm = T,
dir.name = paste("D:/Rtry/SDM",Resp.name,sep = "/"))
#######################Defining Models Options using default options
sdm.opt.default = BIOMOD_ModelingOptions( MAXENT = list( path_to_maxent.jar = "C://Users//Public//maxent.jar"))
####################Constrcut sdm models by setting parameters
Bio.mod.all = BIOMOD_Modeling( bm.format = Sp.biomod.data,
models = "MAXENT",
models.pa = Sp.biomod.data@data.species,
bm.options = sdm.opt.default,
CV.strategy = 'random',
#Number of Evaluation run
CV.nb.rep = 1,
#80% of data train the model
CV.perc = 0.8,
#models be calibrated and validated over the whole dataset
CV.do.full.models = F,
#Below arg is whether control the weight?
weights=NULL,
#absences will be weighted equally to the presences
prevalence = 0.5,
#Set model evaluations methods
metric.eval = mode.eva,
#Number of permutation to estimate variable importance
var.import = 1,
nb.cpu =1,
do.progress =T)
#show errors
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Single Models -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Checking Models arguments...
Warning in .BIOMOD_Modeling.check.args(bm.format = bm.format, modeling.id = modeling.id, :
models.pa has been disabled because no PA datasets have been given
Creating suitable Workdir...
Checking Cross-Validation arguments...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Bandicota.bengalensis.reg.1 Modeling Summary -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 environmental variables ( PCA_1 PCA_2 PCA_3 PCA_4 PCA_5 PCA_6 PCA_7 PCA_8 )
Number of evaluation repetitions : 1
Models selected : MAXENT
Total number of model runs: 1
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=--=-=-=- Bandicota.bengalensis.reg.1_allData_RUN1_MAXENT
Model=MAXENT
> MAXENT modeling...
Creating Maxent Temp Proj Data...
Getting predictions...Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'D:/Rtry/SDM/Bandicota.bengalensis.reg.1/Bandicota.bengalensis.reg.1/models/1696750966/Bandicota.bengalensis.reg.1_allData_RUN1_MAXENT_outputs/Bandicota.bengalensis.reg.1_allData_RUN1_Pred_swd.csv': No such file or directory
Getting predictor contributions...Error in file(fname, "r") : cannot open the connection
In addition: Warning messages:
1: In system(command = maxent.command, wait = TRUE, intern = TRUE) :
running command 'java -mx512m -cp "C:\Users\Public/maxent.jar" density.Project "" "D:/Rtry/SDM/Bandicota.bengalensis.reg.1/Bandicota.bengalensis.reg.1/models/1696750966/Bandicota.bengalensis.reg.1_allData_RUN1_MAXENT_outputs/Predictions/Pred_swdBis_5125.csv" "D:/Rtry/SDM/Bandicota.bengalensis.reg.1/Bandicota.bengalensis.reg.1/models/1696750966/Bandicota.bengalensis.reg.1_allData_RUN1_MAXENT_outputs/projMaxent.asc" doclamp=false visible=false autorun nowarnings notooltips' had status 1
2: In file(fname, "r") :
cannot open file 'D:/Rtry/SDM/Bandicota.bengalensis.reg.1/Bandicota.bengalensis.reg.1/models/1696750966/Bandicota.bengalensis.reg.1_allData_RUN1_MAXENT_outputs/projMaxent.asc': No such file or directory
Error in { : task 1 failed - "Unable to make model prediction"
#show(Bio.mod.all)
Inaddition, my computer system is windows 10; R version is R-4.3.1; Java version is "21" 2023-09-19 LTS; Biomod2 package version is 4.2-4
To now, I really have tried many methods to solve my problem, but them didn't work, If you can help me , I will be great grateful!!!
Thanks , from JY Xie
The text was updated successfully, but these errors were encountered: