Grasshopper Tutorial - Rhino Compute URL connection problem

Hi VIKTOR team.

I recently did a workshop with Marcel and Jasper and we struggled to get the Grasshopper Tutorial working. Since doing the workshop, and trying to debug, I cannot find any solutions.

My setup
Windows 11 Pro version 22H2
PyCharm Professional & Community - Latest Version
Python 3.10 installed from Windows Store
Rhino v7 sr32 (latest)
Hops v0.16.2 (latest)

All dependencies installed:

Debugging Tried

  • I tried different ports, such as localhost:127.0.0.1
  • I tried opening the firewall connections for Rhino, PyCharm, etc.
  • I tried running the 'run_grasshopper.py` script while the internet was off
  • I tried running on Private or Public wifi networks.

The ERROR CODE to the Rhino Compute localhost:

Traceback (most recent call last):
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connection.py", line 203, in _new_conn
    sock = connection.create_connection(
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
    raise err
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request
    conn.request(
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connection.py", line 395, in request
    self.endheaders()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1278, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1038, in _send_output
    self.send(msg)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 976, in send
    self.connect()
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connection.py", line 243, in connect
    self.sock = self._new_conn()
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connection.py", line 218, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001E5E3A1E530>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=6500): Max retries exceeded with url: /grasshopper (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001E5E3A1E530>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Darrel\Documents\Github\KCAPbv\viktor-grasshopper\run_grasshopper.py", line 27, in <module>
    output = gh.EvaluateDefinition(
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\compute_rhino3d\Grasshopper.py", line 57, in EvaluateDefinition
    response = Util.ComputeFetch(url, args)
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\compute_rhino3d\Util.py", line 34, in ComputeFetch
    r = requests.post(posturl, data=postdata, headers=headers)
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\requests\api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Darrel\.virtualenvs\viktor-grasshopper\lib\site-packages\requests\adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=6500): Max retries exceeded with url: /grasshopper (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001E5E3A1E530>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

Hi Maketank,

Welcome to our community!

In order for the Compute server to work correctly, both Rhino and Grasshopper need to be open while running the server. Can you verify that is the case?

Next to the tutorial, we also have a more general description of the integration, maybe that will help you further also. See the docs.

kind regards