Hi everyone,
I’m currently using an external Python script to execute a Grasshopper script that includes Python 3 components for certain calculations. I followed the instructions from the Rhino.Compute Git repository and successfully connected to a localhost.
I can run Grasshopper scripts without issues—provided they don’t contain any Python 3 components. However, when such components are included, the terminal outputs “Python 3 is loading”, after which the Python script stops executing.
Does anyone know how to resolve this issue?
Thanks in advance for your help!
ghload.py (2.2 KB)
voronoi.ghx (203.7 KB)
Hi Anton, thanks for sharing your code - I didn’t know how to use RhinoCompute to run any GH definition.
Have you tested it with a “Hello World” Python 3 component?
If that works, can you just increase the timeout on the requests.post call? If a Python 3 component has to install dependencies using pip, it can indeed take a while - is it possible to cache these, and have the Python3 components reuse a Python environment with them pre-installed using # venv:
?
Hi James, thank you for your response. Yes, I tried running a simple “Hello World” script using a Python 3 component, but unfortunately, it didn’t work-Python 3 isn’t loading. I also attempted to increase the timeout, but that didn’t help either. Perhaps I need to replace the Python components in the GH script with Hops functions defined in Python instead.
You’re welcome. Using Hops is worth a quick try if there’re no answers in the Rhino Compute documentation.
It still reminds me of starting Rhino 8 for the first time, and CPython taking a while to set up, or when you delete the whole CPython env to clear imported packages.