OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

(WIP) Allow running local runtime on windows

Open li-boxuan opened this issue 9 months ago • 3 comments

Add local runtime support for windows (not WSL)

TODOs:

  • [x] Can launch execution server
  • [x] Can run stateful commands
  • [x] Can run Jupyter notebook
  • [ ] Can pass simple E2E examples
  • [ ] Can run browser

li-boxuan avatar Mar 22 '25 02:03 li-boxuan

I run the project with "local runtime" mode, but failed.

09:59:57 - openhands:INFO: local_runtime.py:297 - [runtime f78631cf-d16e-4c46-b0a1-0ab7fab70cd2-ffc6092f680389ce] Waiting for server to become ready at http://localhost:32135...
ERROR:root:  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "F:\OpenHands-windows\openhands\core\main.py", line 297, in <module>
    asyncio.run(
  File "D:\Software\Python12\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "F:\OpenHands-windows\openhands\core\main.py", line 109, in run_controller
    call_async_from_sync(runtime.connect)
  File "F:\OpenHands-windows\openhands\utils\async_utils.py", line 50, in call_async_from_sync
    result = future.result()
             ^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\concurrent\futures\_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "D:\Software\Python12\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\OpenHands-windows\openhands\utils\async_utils.py", line 44, in run
    return asyncio.run(arun())
           ^^^^^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Software\Python12\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "F:\OpenHands-windows\openhands\utils\async_utils.py", line 37, in arun
    result = await coro
             ^^^^^^^^^^
  File "F:\OpenHands-windows\openhands\runtime\impl\local\local_runtime.py", line 300, in connect
    await call_sync_from_async(self._wait_until_alive)
  File "F:\OpenHands-windows\openhands\utils\async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "D:\Software\Python12\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\OpenHands-windows\openhands\utils\async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "F:\myvirtualenvs\openhands-ai-PjGo2xr8-py3.12\Lib\site-packages\tenacity\__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "F:\myvirtualenvs\openhands-ai-PjGo2xr8-py3.12\Lib\site-packages\tenacity\__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\myvirtualenvs\openhands-ai-PjGo2xr8-py3.12\Lib\site-packages\tenacity\__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "F:\myvirtualenvs\openhands-ai-PjGo2xr8-py3.12\Lib\site-packages\tenacity\__init__.py", line 419, in exc_check
    raise retry_exc from fut.exception()

ERROR:root:<class 'tenacity.RetryError'>: RetryError[<Future at 0x19149076e10 state=finished raised RuntimeError>]

yangshshsh avatar Apr 10 '25 02:04 yangshshsh

@yangshshsh Windows local runtime support is still under development and not ready to use. Stay tuned ;)

li-boxuan avatar Apr 10 '25 04:04 li-boxuan

I really appreciate your work, hope to use it as soon as possible

yangshshsh avatar Apr 10 '25 07:04 yangshshsh

I am getting error requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1, port=8080): Max tries exceeded with url: /execue_action (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at ox000001BE64855280>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

Can you please help me with this?

chandrabhankushwaha avatar Apr 21 '25 13:04 chandrabhankushwaha

@OpenHands

Try to install poetry 2.1.2 and run poetry lock to regenerate the lock file. Then commit here.

You don't need to run tests, I took care of that in CI.

li-boxuan avatar May 02 '25 03:05 li-boxuan

Uh oh! There was an unexpected error starting the job :(

openhands-ai[bot] avatar May 02 '25 03:05 openhands-ai[bot]

@yangshshsh @chandrabhankushwaha windows support is available now. Welcome to try it out and provide any feedback! I am using it in my windows-only project and so far, so good.

Note1: I am using headless mode. I am not sure if the frontend works with windows. Note2: You need to set runtime = "local" in config.toml. Note3: No browser support as of now.

[core]
runtime = "local"

li-boxuan avatar May 02 '25 11:05 li-boxuan

Seems a great contribution! Code looks reasonably to me so far I'll let someone more familiar with the local runtime weigh in if possible

raymyers avatar May 02 '25 13:05 raymyers

Something's broken the CI. Will investigate it later.

UPDATE: done. It's an existing glitch that was covered by another glitch introduced by this PR. Now fixed in 1f010cc.

li-boxuan avatar May 06 '25 03:05 li-boxuan

@yangshshsh @chandrabhankushwaha windows support is available now. Welcome to try it out and provide any feedback! I am using it in my windows-only project and so far, so good.

Note1: I am using headless mode. I am not sure if the frontend works with windows. Note2: You need to set runtime = "local" in config.toml. Note3: No browser support as of now.

[core]
runtime = "local"

I am getting Error RuntimeError: JupyterRequirement not found . Unable to run IPython action - Is this fixed in recent changes?

chandrabhankushwaha avatar May 07 '25 08:05 chandrabhankushwaha

@yangshshsh @chandrabhankushwaha windows support is available now. Welcome to try it out and provide any feedback! I am using it in my windows-only project and so far, so good. Note1: I am using headless mode. I am not sure if the frontend works with windows. Note2: You need to set runtime = "local" in config.toml. Note3: No browser support as of now.

[core]
runtime = "local"

I am getting Error RuntimeError: JupyterRequirement not found . Unable to run IPython action - Is this fixed in recent changes?

Can you try latest main branch? If you are still getting this error, could you please provide more details of how you run it?

li-boxuan avatar May 07 '25 20:05 li-boxuan