I’m encountering an error when trying to load a “TorchScript model” inside Rhino/Grasshopper using RhinoCode. The script I’m using is:
model = torch.jit.load(model_path)
However, I get the following error:
Unknown builtin op: torch_scatter::segment_sum_csr.
Could not find any similar ops to torch_scatter::segment_sum_csr.
This seems related to “torch_scatter”, but my code runs fine in PyCharm with the same Python environment. It looks like there might be an issue with installing “torch_scatter” properly in Rhino.
Has anyone encountered this issue when using PyTorch Geometric inside Rhino/Grasshopper? Any suggestions on how to resolve this?
I have used torch in Rhino but not torch_scatter specifically. I see this error when trying to install
pip install error | Collecting torch-scatter
Using cached torch_scatter-2.1.2.tar.gz (108 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\ein\AppData\Local\Temp\pip-install-5w4iiii9\torch-scatter_f7e630f5c6a148c184420ee2589236b1\setup.py", line 8, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.