Mesa within GhPython

Hi guys,

I was wondering if Mesa for the agent-based modelling (ABM)could be used within GHpython yet?
as far as I see it is based on Python 3 but GhPython is still 2.7 or at least the python remote is only compatible with python 2.7 and not with 3!
is there any other way around? if I want to use an ABM framework within grasshopper and & rhino environment? or is there something I am getting wrong?

*I didn’t find anyone discussing using Mesa within grasshopper so I feel maybe I am missing something?

Thanks,

Welcome @AmmarTaher,

Yes, but that’s not the only issue! RhinoPython and GHPython are based on IronPython, which is derived from and integrated into Microsoft’s .Net Framework.
What you’re looking for is CPython, which is - as the name implies - based on the programming language C, much more robust, and advanced in terms of development.

Since PythonRemote is not an option, you could try Rhino Compute, which seems to work with Python 3.7.

Another option would be to divide your process into two or more parts. Basically you would do the Mesa computation in Python 3 outside of Rhino, and export the resulting data in some kind of manageable format (e.g. txt, csv, json, etc.). Back in Rhino/Grasshopper, you’d import that data, parse it into something useable, and turn it for instance into geometry.