All-Hands-AI / openhands-resolver

A system that tries to resolve all issues on a github repo with OpenHands.
MIT License
36 stars 10 forks source link

Docker error fetching server API version #172

Open malhotra5 opened 3 weeks ago

malhotra5 commented 3 weeks ago

Hello,

when running openhands resolver I got the following error log

Command run: python -m openhands_resolver.resolve_issues --repo NaturalAgents/NaturalAgents --issue-numbers 4

Error log:

22:55:27 - openhands:INFO: resolve_issues.py:447 - Limiting resolving to issues [4].
22:55:27 - openhands:INFO: resolve_issues.py:459 - Using output directory: output
22:55:27 - openhands:INFO: resolve_issues.py:483 - Base commit: 196e5ce6afa0c4412e40eebc947188895730bcdc
22:55:27 - openhands:INFO: resolve_issues.py:494 - Writing output to output/output.jsonl
22:55:27 - openhands:WARNING: resolve_issues.py:501 - Output file output/output.jsonl already exists. Loaded 0 finished issues.
22:55:27 - openhands:INFO: resolve_issues.py:506 - Resolving issues with Agent CodeActAgent, model gpt4o, max iterations 30.
22:55:27 - openhands:INFO: resolve_issues.py:518 - Finished issues: 0, Remaining issues: 1
  0%|                                                                                                                                                | 0/1 [00:00<?, ?it/s]22:55:27 - openhands:INFO: resolve_issues.py:526 - Using 1 workers.
22:55:27 - openhands:INFO: resolve_issues.py:264 - Starting fixing issue 4.
22:55:27 - openhands:INFO: main.py:73 - Initializing runtime: EventStreamRuntime
22:55:27 - openhands:ERROR: runtime.py:200 - Launch docker client failed. Please make sure you have installed docker and started docker desktop/daemon.
ERROR:root:  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands_resolver/resolve_issues.py", line 720, in <module>
    main()
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands_resolver/resolve_issues.py", line 700, in main
    asyncio.run(
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands_resolver/resolve_issues.py", line 556, in resolve_issues
    await asyncio.gather(*[run_with_semaphore(task) for task in tasks])
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands_resolver/resolve_issues.py", line 554, in run_with_semaphore
    return await task
           ^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands_resolver/resolve_issues.py", line 397, in update_progress
    resolved_output = await output
                      ^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands_resolver/resolve_issues.py", line 292, in process_issue
    runtime = create_runtime(config, sid=f"{issue.number}")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands/core/main.py", line 74, in create_runtime
    runtime: Runtime = runtime_cls(
                       ^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands/runtime/client/runtime.py", line 138, in __init__
    self.docker_client: docker.DockerClient = self._init_docker_client()
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands/runtime/client/runtime.py", line 203, in _init_docker_client
    raise ex
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/openhands/runtime/client/runtime.py", line 198, in _init_docker_client
    return docker.from_env()
           ^^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/docker/client.py", line 94, in from_env
    return cls(
           ^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/docker/api/client.py", line 207, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rohitmalhotra/miniconda3/lib/python3.11/site-packages/docker/api/client.py", line 230, in _retrieve_server_version
    raise DockerException(

ERROR:root:<class 'docker.errors.DockerException'>: Error while fetching server API version: Not supported URL scheme http+docker
  0%|                                                                                  

I resolved the issue via pip3 install requests==2.31.0. I found the solution from this thread on stackoverflow: https://stackoverflow.com/questions/64952238/docker-errors-dockerexception-error-while-fetching-server-api-version

Wanted to attach this incase anyone else was facing this issue; cheers!

neubig commented 1 week ago

Thanks! We'll try to make this more robust going forward.