csdms / help-desk

The CSDMS Help Desk. Ask questions. Get answers (about CSDMS products and services).
MIT License
6 stars 1 forks source link

setting up/running pynetlogo tutorial #24

Open jillmarshall opened 4 years ago

jillmarshall commented 4 years ago

Hi - I'm trying to work my way through the pynetlogo tutorials (https://pynetlogo.readthedocs.io/en/latest/) - Two issues - I think unrelated. Likely because I'm still new to installing these type of packages as well as setting things up in the correct directories.

The easiest 'issue' is I don't see example 1 in the github repository I downloaded. So can't run it -but this is not a CSDMS problem

Unrelated? though i expect the problem would pop up if I tried to run the missing tutorial - I think Ive installed everything I need (through Anaconda) but when I try to copy and paste the example code into a new jupyter notebook I get errors on the very first cell - I'm in the folder where the files are so I think I'm in the right place. I've installed pynetlogo, Jpype but I have not done anything with the Python extension for NetLogo (I didn't understand how to use it)

if you have time it would be great to chat by phone/share my screen with you - Jill

TypeError                                 Traceback (most recent call last)
<ipython-input-1-14aac9fcc9d1> in <module>
      9 import pyNetLogo
     10 
---> 11 netlogo = pyNetLogo.NetLogoLink(gui=True)
     12 
     13 netlogo.load_model('./models/Wolf Sheep Predation_v6.nlogo')

~\anaconda3\lib\site-packages\pyNetLogo\core.py in __init__(self, gui, thd, netlogo_home, netlogo_version, jvm_home, jvmargs)
    219             netlogo_home = get_netlogo_home()
    220         if not netlogo_version:
--> 221             netlogo_version = establish_netlogoversion(netlogo_home)
    222         if not jvm_home:
    223             jvm_home = jpype.getDefaultJVMPath()

~\anaconda3\lib\site-packages\pyNetLogo\core.py in establish_netlogoversion(path)
    104     pattern = re.compile(r'(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$')
    105 
--> 106     netlogo = os.path.basename(os.path.normpath(path))
    107     match = pattern.search(netlogo)
    108     version = match.group()

~\anaconda3\lib\ntpath.py in normpath(path)
    450 def normpath(path):
    451     """Normalize path, eliminating double slashes, etc."""
--> 452     path = os.fspath(path)
    453     if isinstance(path, bytes):
    454         sep = b'\\'

TypeError: expected str, bytes or os.PathLike object, not NoneType
mcflugen commented 4 years ago

@jillmarshall This might be a better question for the pynetlogo people. However, it looks to me like pynetlogo is trying to find what version of netlogo you have installed, but it can't find a netlogo installation. Do you have netlogo installed on your computer? If so, did you maybe install it somewhere outside of the usual location?

jillmarshall commented 4 years ago

Eric - I am really a newbie at stuff like this! Just working my way through the documentation on what to install before a CSDMS's workshoppy thang this afternoon. I’ve installed it (not sure what the usual place is except it defaulted to the usual program file) and now getting a java error –near as I can tell I set that up properly but again new to all this

JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.

I think for now I’ll just read the tutorial rather than trying to get it running.

mcflugen commented 4 years ago

@jillmarshall I think the default location (under ProgramFiles on Windows) would be the usual place and where pynetlogo should look for netlogo. Based on the netlogo docs, it sounds like it should come with a Java installation embedded within it, so it's strange to me that it can't find it.

I've never used netlogo before so I can't be of much more help, I'm afraid. Perhaps someone at the workshop this afternoon can help. If you do figure it out, will you please post your solution here so that others may find it?