rspatial / dismo

R dismo package
GNU General Public License v3.0
22 stars 11 forks source link

r studio crashing with maxent() #13

Closed msedaghatpour closed 2 years ago

msedaghatpour commented 3 years ago

r studio crashes when i try to run this code: [ Asclepias_curtissii_enm.mx <- maxent(species = Asclepias_curtissii_enm, env = envt.subset, test.prop = 0.25) ]

it also crashes with the same Java message when running maxent() in the example code in the documentation.

OS version: Catalina 10.15.7 Java version: 15.0.1 R version: 4.0.3 R studio version: 1.2.1335 Maxent version: 3.4.4

This is the message when it crashes. A specific error message doesnt print in the console. image

rhijmans commented 3 years ago

Can you run the maxent app (maxent.jar) outside of R? Can you update the maxent.jar file to the latest version and see what happens?

msedaghatpour commented 3 years ago

The Maxent GUI works just fine. Maxent 3.4.4 is the latest version as are R and Java.

charlovolpe commented 3 years ago

Did you manage to solve this issue? I am currently running into the same problem.

rbfontana commented 2 years ago

Has anyone managed to solve this problem? I'm going through the same

dandeangelis commented 2 years ago

I am also currently running into the same issue. Any help would be enormously appreciated! Thanks!!

Stuart54 commented 2 years ago

This seems to be an issue with running via RStudio. My setup: R 4.2, RStudio 2022.02.2 Build 485, running on Windows 10 dismo 1.3-5 R\win-library\4.2\dismo\java\maxent.jar version 3.4.4 java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

The following code reproduces the problem: library(dismo) maxent()

The result is as shown in OP. RStudio produces "R session Aborted - R encountered a fatal error ... ".

If I run the same code directly from the R console (i.e. not via RStudio), it works fine:

image

I can perform a Maxent analysis by running the maxent.jar directly (via a .bat file as recommended) and it works as expected.

dandeangelis commented 2 years ago

Hi everybody, for me updating my Mac OS from Catalina to BigSur solved the problem. It was not necessary to perform a fresh install of the new OS. It took me almost one week to figure out the problem... I hope this can be of help Daniele

AndreMBellve commented 2 years ago

Hi there,

I am having the same issue as Stuart54 - if I try to run dismo::maxent() from inside Rstudio, it produces a fatal error and crashes, sometimes without any warning. However, it is fine if I run this from base R.

Here is my session info: R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)

Matrix products: default

The version of RStudio is "Prairie Trillium" Release (8acbd38b, 2022-04-19) for Windows (Build 485). I am using dismo 1.3-5

Any suggestions or is a fix on the way?

Cheers, André

rbfontana commented 2 years ago

Hello, I think it is some problem with the current version of R (4.2.0) when used together with RStudio. I went back to the previous version (4.1.3) and it worked. Best, Rodrigo

rhijmans commented 2 years ago

On windows, I can do dismo::maxent() in R-gui in with R 4.1.4, 4.2.0, 4.2.0patched, and 4.3.0 (pre-release). However, on windows it fails with current R-Studio (2022.02.2 Build 485) with R version 4.2.0

Thus: when using R-Studio you cannot run maxent() with R version 4.2.0 (at least on windows). Use an older version, or the patched version instead. Available here https://cran.r-project.org/bin/windows/base/rpatched.html

rhijmans commented 2 years ago

This problem may have happened for different reasons in different versions of R and on different operating systems. But I am closing this issue now, as it has been resolved for what is the current main stumbling block (a bug in R4.2.0 with RStudio). If you have a similar problem in a different context, feel free to open a new issue.

Stuart54 commented 2 years ago

Updating to R 4.2.1 fixes it for me.