Closed LorenzoBernicchi closed 5 months ago
Hi Lorenzo,
Thanks for all the details 🙏
I didn't think it was a path length issue but rather a problem with java
.
If you haven't done it for a long time, I'd advise you to update java
and maxent.
You'll also need to check if you have all the permissions on maxent.jar
.
I admit it's strange that this doesn't happen for all runs with MAXENT
. If the update isn't enough, I'll probably need your data to reproduce the error.
Have a good day, Hélène
Hello @HeleneBlt,
I just checked, and actually I had old version of both java
and maxent
.
I updated them and I will try again as soon as I can.
I will let you know, thanks for the moment!
EDIT I tried again (with Java 8 Update 411 and Maxet 3.4.4) and I still get the error, this time the task failed is the number 55. I will share my data with you with the following comment.
Have a nice day, Lorenzo Bernicchi
Dear @HeleneBlt
Here I attach a compressed folder where you can find all the data you could need to reproduce the error: the file excel with presence data, the R script I am running and two .shp
files of the modeling background areas.
In the folder there are not the environmental variables I use, since it would be too heavy (like 10 GB). However, I use the climatic variables that I downloaded from the WorldClim website (https://www.worldclim.org/data/worldclim21.html).
Here you can download the folder: Cervo_nuovo_CA.zip
Let me know is you can reproduce the error, in these days I will try with another computer, much more powerful. Maybe it's a memory issue, I really don't know.
Thanks again, have a nice day! Lorenzo Bernicchi
Hi Lorenzo,
I'm sorry but I couldn't reproduce the error. It runs smoothly with my computer (and the data data("bioclim_current")
of biomod2
). In my case, the data are really lighter so you cannot exclude a memory issue.
I can only advise you to try with another computer as you suggest, check the different updates and check the permissions.
Sorry 😬
Hope you will find a solution! Hélène
Hello @HeleneBlt
Thanks to let me know, that's not what I was hoping for unfortunately.
I will try on another PC with more RAM, I really hope that it will work.
Thanks for now, I really appreciated your support! Have a nice day!
Lorenzo Bernicchi
Hello @HeleneBlt ,
I just tried removing the GBM
from the algorithms I was using. And guess what? Now I don't get the error anymore!
Maybe it was a problem related to package version used to run the GBM
? Do you have any idea of the reason behind this strange error?
Hello Lorenzo :wave:
I just had word from Gafarou who sent me his data and scripts, as he was encoutering the same error as you :eyes:
Error in { : task 3 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: In bm_RunModelsLoop(bm.format = bm.format, weights = weights, calib.lines = calib.lines, :
Parallelisation with `foreach` is not available for Windows. Sorry.
3: In file(con, "r") :
cannot open file './Adansonia.digitata/models/Single.models/Adansonia.digitata_PA1_RUN1_MAXENT_outputs/maxent.stderr': Permission denied
4: In file(con, "r") :
cannot open file './Adansonia.digitata/models/Single.models/Adansonia.digitata_PA1_RUN2_MAXENT_outputs/maxent.stderr': Permission denied
5: In file(con, "r") :
cannot open file './Adansonia.digitata/models/Single.models/Adansonia.digitata_PA2_RUN1_MAXENT_outputs/maxent.stderr': Permission denied
6: In file(con, "r") :
cannot open file './Adansonia.digitata/models/Single.models/Adansonia.digitata_PA2_RUN2_MAXENT_outputs/maxent.stderr': Permission denied
He was using biomod2 4.2-5
and MAXENT 3.4.4
, and I was actually able to run his script without getting any error on my computer :heavy_check_mark:
He was running 4 single models : GLM
, GAM
, MAXENT
and RF
(so no GBM
).
:arrow_right: so unless I have the same configuration as Hélène (but she's working on Windows, and I'm on Ubuntu), maybe it is really coming from computer resources limit ?
:arrow_right: or as Hélène mentioned earlier, it might come from your java
configuration and rights (https://github.com/biomodhub/biomod2/issues/291#issuecomment-1628578092) ?
Maya
Hello @MayaGueguen ,
In these days I am trying a different model, using a much smaller area and, therefore, I used much less space. So I am pretty sure this is not an issue related to limited computer resources.
About java
configuration and rights: I am able to open and execute the maxent.jar
, so I was pretty sure I correctly set all the permissions and rights, but it seems not since I still get the error Cannot open the file ./Capreolus.CA/models/Single.models/Capreolus.CA_PA1_RUN3_MAXENT_outputs/maxent.stderr': Permission denied
. From the security tab in the property dialog box I checked all the options, so that should be good, right?
May I ask you how I should configure java
? Maybe I am missing some important stuff. It's getting really frustating.
A LITTLE UPDATE
In the grip of frustration I decided to uninstall java and delete the maxent.jar
file. The really first time I run the model everything worked properly, so I decided to do several tests as I originally intended. I noticed that sometimes everything worked fine, while other times (without changing any options except the number of CV.nb.rep
) I got the usual error about maxent.
Furthermore, I have noticed that the first time I open R
and run the code I encounter the error almost every time. However, if I delete the R
environment and the data created within the directory where I work and if I run the model again without closing R
, everything works perfectly every time (I already did something like 50 trials, so a good number I guess).
This situation is taking on somewhat mysterious aspects!!
Thanks for your help, I really appreciate it. Lorenzo Bernicchi
Hi Lorenzo !
Indeed it's a mystery 🤔 We face another issue with some hidden connections blocking MAXENT and other models under Windows specifically. By deleting the R environment, you close these hidden connections, so maybe it is related. Could you try, directly when you open R, to run:
env <- foreach:::.foreachGlobals
rm(list = ls(name = env), pos = env)
and after, run the model ?
Hélène
Hello @MayaGueguen ,
I just added the code lines you wrote me in the previous comment. I paste them at the beginning of my code and run them as soon as I open R. Unfortunately, nothing changed: most of the time I run the script I get the error, I have to run it like 10/15 times only to get a one single model output. And since I would like to test several model parameters and other stuff, this is getting really time consuming.
I really don't know what to think aout the potential issue, but really thanks anyway for your help! Have a nice day, Lorenzo Bernicchi
Dear @MayaGueguen ,
It's still me, unfortunately.
I downloaded the development version of the package, the 4.2-5-2
, but the error still occurs.
Did you find any potential bug causing this issue, by any chance?
Thanks for all your help, I really appreciate it. Have a nice day, Lorenzo Bernicchi
Hello Lorenzo,
Could you check and try this issue please ? https://github.com/biomodhub/biomod2/issues/455#issuecomment-2127563951 Colin seems to have found a solution that works for both him and Chenyong, but I'm not 100% sure that they were in the same case than you :eyes:
Maya
Hello @MayaGueguen , I was just about to write you again! Yesterday I found the issue you just mentioned, and it works!!! I am really happy, but I justt opened a new issue for another advice I need!
Thank you anyway, I really appreciate it!
Error and context
Hello everyone. I am modeling the distribution of cervus elaphus on a global scale, using the bioclimatic variables I downloaded from WorldClim. I prepared all my data: checking for multicollinearity among variables, thinning my occurrences and so on. When I start with biomod modeling steps, everytime I face the same error:
Error in { : task 27 failed - "cannot open the connection"
In addition: there are more than 50 warnings 1: In .bm_ModelingOptions.check.args(data.type = data.type, ... : Only one GAM model can be activated. 'GAM.mgcv.gam' has been set (other available : 'GAM.gam.gam' or 'GAM.mgcv.bam') 2: In bm_RunModelsLoop(bm.format = bm.format, weights = weights, ... : Parallelisation with
foreach
is not available for Windows. Sorry. 3: executing %dopar% sequentially: no parallel backend registered 36: In file(con, "r") : non è possibile aprire il file './Cervus.global.nuovo.CA/models/Single.models/Cervus.global.nuovo.CA_PA1_RUN4_MAXENT_outputs/maxent.stderr': Permission denied 37: In predict.gbm(get_formal_model(object), as.data.frame(newdata[not_na_rows, ... : Number of trees not specified or exceeded number fit so far. Using 100. (I get a lot of this last type of error)The number after the word "task" changes everytime, but I always get the same warning messages: the ones about
GAM
,MAXENT
and a bunch of equal errors for theGBM
.Code used to get the error
When the
BIOMOD_Modeling
function is running, on the screen I can see the progress bars as well as the different step of each algorithm. Regarding theMAXENT
algorithm, this is what I can generally read on the console:On the other end, for some
CV.run
I can read this:Note how the CV.run was the same as in the warning message I wrote at the beginning, but that was not the only
CV.run
that behaved like this.Environment Information
Herefater, I also attach the list of my R packages and the corresponding versions. list_of_package_version.csv
I already read some issues that explained the same problem, and I already tried the already provided solutions. The directory I am working in it is the shortest possible:
C:/Cervo_EcoRegioni_CA/
. Moreover, I am using a pretty powerful computer: it is an ASUS laptop, with an AMD Ryzen 7 6800 HS processor and 16 GB of RAM, and an NVIDIA GeForce RTX 3050 Laptop GPU GDDR6 with 4 GB of RAM.Could this problem be a matter of packages version that interfere one another? I really don't know why this issues continues to happen, but it's getting really frustrating unfortunately.
I thank you so much for all your effort you dedicate to
biomod2
: I really love to model with this package!! I wish you a good day, best regards!