NetLogo / Python-Extension

Python extension for NetLogo
26 stars 15 forks source link

NetLogo does not import Python libraries at runtime? #15

Closed reprazent-22 closed 5 years ago

reprazent-22 commented 5 years ago

My NetLogo (6.0.1) is able to execute Python (3.7.4) but doesn't import numpy, etc.

I'm on a Windows 8.1 machine, Python is installed thru MiniConda, and I've create an environment for Python 3.

How to get NetLogo to see Python packages???

qiemem commented 5 years ago

It's probably using your system python environment rather than the miniconda one. You can either run py:setup "/path/to/miniconda/python"or use the Python extension configuration menu to set it to use that Python environment by default.

LaCuneta commented 5 years ago

@reprazent-22 Also, it wasn't quite clear to me from your issue, but you do have to import numpy in your model with a call like py:run "import numpy". The Python extension will not import packages for you.

I would also recommend updating to NetLogo 6.1.1 if possible (which is bundled with 0.4.3 of the Python extension), just to be sure you don't have any version conflicts as I don't know how well the Python extension worked with NetLogo 6.0.1.

reprazent-22 commented 5 years ago

Thanks, LaCuneta! NetLogo 6.1.1 with the Python extension bundled solved the problem. (NetLogo 6.0.1 gave strange Java runtime errors, upon trying to import Python packages with the Python extension.)

Perhaps indicate that it's bundled in your README?