I’ve made some Grasshopper Python components that I’m running on a VM that I followed via the official tuts using Rhino Compute but having some issues with a few scripts. They all work fine locally on my local machine.
I believe the problem is related to external Python modules. I install these modules at the top of the component using the syntax # r: pydelatin, numpy, rasterio, scipy and locally it works great.
Now I tried running this script on my Rhino Compute instance and it’s not working, and I imagine it has something to do with using these external modules because I have another Python component where I just use built-in modules and there were no issues. I also don’t know how to properly debug what’s going wrong.
If you think this could be the issue, what is the proper way to install external Python modules on a Rhino Compute server. I read somewhere that I can do this syntax at the top of my Python Component instead and might have more luck:
#! python 3
# venv: my-grasshopper-file
# r: pydelatin, numpy, rasterio, scipy
import pydelatin, numpy, rasterio, scipy
Should I do this instead?
I’m used to creating a venv at the project level for whatever Python project I’m working on, so in that case, should all Python components in a Grasshopper file point towards the same venv?
Say one Grasshopper Python node does this at the top:
#! python 3
# venv: my-grasshopper-file
# r: pydelatin, numpy, rasterio, scipy
import pydelatin, numpy, rasterio, scipy
And in another node further along in the graph I want to reuse numpy do I just do:
#! python 3
# venv: my-grasshopper file
import numpy
So I point it at the same venv file? Or do I reimport with # r.
And then if this is the issue and it does start working, now does every Rhino Compute instance on startup reinstall the modules?
Sorry for all the questions.
Thanks,
Aidan