pyNetLogo icon indicating copy to clipboard operation
pyNetLogo copied to clipboard

Model with R-Extension crashes

Open paulmorio opened this issue 4 years ago • 2 comments

Dear authors of pyNetLogo,

I have a NetLogo model which uses the R-Extension to run R commands within the NetLogo model.

I would like to use PyNetLogo to automate work with multiple instances but I am unable to load_model that uses the R Extension in any way. One can replicate using any of the example netlogo models provided with the R-Extension included since NetLogo 6.04

import pyNetLogo
netlogo = pyNetLogo.NetLogoLink(gui=True)
netlogo.load_model('C:/Program Files/NetLogo 6.0.4/app/extensions/r/models/example1.nlogo')

Copying the entire R extension as in issue #13 does not solve this issue unfortunately. I would appreciate any help!

EDIT: I have been able to get around this issue in one sense by setting JAVA_HOME environment variable to point to NetLogo's own internal JVM. However I fear this is not a long term solution as the official installation instructions (from the JPype instructions) point towards setting JAVA_HOME to whatever JDK is installed.

paulmorio avatar Jun 27 '20 23:06 paulmorio

what OS are you using? It sounds like you are using windows. It might be that the class has to do with whatever JVM is being used by jpype needs to also match with whatever ivm. thee R-extension is assuming.

quaquel avatar Jun 29 '20 19:06 quaquel

Hello quaquel,

Thanks for the quick response, indeed I am using Windows for this. Yeah that is why I did the work-around by setting the JAVA_HOME system variable to the JVM runtime NetLogo is packaged with. This alleviates issues with the R-Extension (as well as all other standard extensions I used, without having to move them into the same location as the NetLogo Model file)

It might be a useful note in the installation instructions. (Alleviates need to install JDK as instructed for JPype) if they are only interested in working with the NetLogo. Eitherway PyNetLogo is great! Thanks for building this tool.

Best regards, paulmorio

paulmorio avatar Jul 06 '20 13:07 paulmorio