Installing Python libraries in Grasshopper

Hi, I am trying to import a script that I made in Python 3.6.5 into Grasshopper using the Python script. In my code I use the following libraries:

  • Numpy
  • Pillow
  • Matplotlib
  • OR-Tools
  • SciPy

There is any way to use them also in the Python component in grasshopper?
thanks

1 Like

I think GH PYTHON REMOTE is what you’re looking for.

Hi,
I used GhC_Python to use these libraries in gh, and it works pretty well ! It just has some trouble outputing gh format data (lists, trees). The workaround is to put a classical GhPython component behind to get the right format.

Cheers

So using this component I can run my script as when I run it in IDLE? With all differents library?

GH Python remote seems to only work for python 2.7. Is it possible to get GH Python remote to work for Python 3.x?

@leland.curtis unfortunately any Python running in Rhino or GH is limited to 2.7 because of IronPython. See this comment on Food4Rhino.

hello

Other options include Rhino Inside CPython (needs Rhino 7 WIP) and Rhino3dm (limited capabilities) , possibly combined with rhino compute for the good stuff

-Graham

1 Like

Awesome! Thank you :slight_smile:

Hey, I am curious if there is any new possibility with Python for Grasshopper in Rhino 7 - I guess it is still based on IronPython?

In other words, is there now a workaround to handle Python modules within Grasshopper that are based on Python 3.7+ … thx.

Yes, still IronPython.

I think everything relevant was already mentioned above.

So this means basically no? I guess the Rhino Inside approach is not suitable if you want to combine it with Grasshopper as it just allows you to work with Rhino Geometry.

GH Python Remote and the CPython add-on allow limited use of CPython in Grasshopper.