Problem with Grasshopper

Hi there,

I am trying to create my own app based on Grasshopper script.

I tried to follow the tutorial. In particular, I can generate the interface, but when I click on 'Run Grasshopper, this error message appears on PyCharm:

Also, I have noticed that the input.json disappears after running the code.

This is the error on the generic worker (I followed all the instructions for the set up of the worker):

Can you help me?

Hi Jacopo,

Did you make sure to install the required packages as it stated in the tutorial?

Hi Daniel,

Yes, I have installed the package in the Grasshopper Python script. Indeed, the script works well when I compile it.

Any other ideas?

Great, are you running the worker as administrator?

Yes,

and I changed the yaml file according to my locations:

Okay, could it be the case that you installed the packages using the pip install compute-rhino3d in a virtual environment within your IDE?
You could try and test the run_grasshopper.py file more thoroughly by running it through the command line. To do that open a command window (type cmd in your windows menu) and in that command window navigate to the folder where the .py file resides (cd "C:\Users\<your_name>\viktor-grasshopper") and then run the file (python run_grasshopper.py)

I suspect that should return the same error, in that case, try installing the two packages in the same command window and re-run the test

1 Like

Yes, I have the same problem

Where I have to install the package? In the cmd?

Yes! That should work

Ran into the same error and installing the packages in the command window worked! Many thanks

2 Likes

Great! hopefully this will also work for @jlettori, if it is the solution, please let me know, then we can mark it as such!

Hi,

Unfortunately, it does not work. I installed the packages directly in the cmd (rhino3dm and compute_rhino3d). This is the error in the generic worker:

This is the terminal in PyCharm of the app:

this is the rhino.compute:

Again, the input.json file disappeared.

so what happens if you now re-run this test?

This script appears:

Hi there,
Iโ€™ve had the same problem. Did you discover the solution?

Hi Elias and Jacopo,

Could it be possible that either Rhino or Grasshopper is not running at the moment youโ€™re testing your script? As stated in the tutorial (Tutorial - Integrate Rhino/Grasshopper | VIKTOR Documentation) both need to be actively running in order to test the run_grasshopper.py script.

Also, pay close attention to step 2 of the Hops installation (Tutorial - Integrate Rhino/Grasshopper | VIKTOR Documentation). The recommendation is to uncheck the Hide Rhino Compute Console Window, which makes it easier to see when it is or is not running.

Let me know if that was indeed the issue!

Hi @Daniel

I did the hops, created the Rhino/Grasshopper folder, ran run_grasshopper.py. And then I did the worker step up, and apparently, itโ€™s working. I can launch the application, but when I press the run grasshopper button an error appears, and the input.json file disappears from the viktor-grasshopper folder.

Hi @Daniel, Iโ€™ve certainly overcome this problem by now, but I have a question. How do I get the data from GeoPolygonField into my model in grasshopper?

@Elias how did you solve it? I am facing the exact same issue! and when I run the .py file in the cmd inside the folder it runs. but on the worker is shows the same error
import compute_rhino3d.Grasshopper as gh
ModuleNotFoundError: No module named โ€˜compute_rhino3dโ€™
@Daniel is there a solution for this?

Hi Mo,

Again Iโ€™d want to ask first how and where you installed the two packages?

Hi @Daniel I did the step from the installation guide through the cmd command line as described in (Tutorial - Integrate Rhino/Grasshopper) I am running Python 3.10.8
pip install in Windows Powershell. No local environments, and I make sure that rhino 7 and GH are open