All-Hands-AI / OpenHands

🙌 OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
36.25k stars 4.13k forks source link

unable to run OpenDevin inference on MacOS with Podman #2651

Closed jatinganhotra closed 2 weeks ago

jatinganhotra commented 4 months ago

Hi team, I am unable to run OpenDevin inference on MacOS with Podman:

MacOS - 14.5 (23F79) Podman Desktop - Version 1.11.1 (1.11.1)

OpenDevin development environment has been setup following the instructions : https://github.com/OpenDevin/OpenDevin/blob/main/Development.md

Inference run with command:

→ USE_HOST_NETWORK=true ./evaluation/swe_bench/scripts/run_infer.sh eval_gpt4_1106_preview  MyAgent
config used:
Config for evaluation: AppConfig(llm=LLMConfig(model='gpt-4-1106-preview', api_key='******', base_url=None, api_version=None, embedding_model='', embedding_base_url=None, embedding_deployment_name=None, aws_access_key_id='******', aws_secret_access_key='******', aws_region_name=None, num_retries=5, retry_min_wait=3, retry_max_wait=60, timeout=None, max_chars=5000000, temperature=0.0, top_p=0.5, custom_llm_provider=None, max_input_tokens=None, max_output_tokens=None, input_cost_per_token=None, output_cost_per_token=None), agent=AgentConfig(name='CodeActAgent', memory_enabled=False, memory_max_threads=2), runtime='server', file_store='memory', file_store_path='/tmp/file_store', workspace_base='/Users/jatinganhotra/OpenDevin/OpenDevin/workspace', workspace_mount_path='/Users/jatinganhotra/OpenDevin/OpenDevin/workspace', workspace_mount_path_in_sandbox='/workspace', workspace_mount_rewrite=None, cache_dir='/tmp/cache', sandbox_container_image='ghcr.io/opendevin/sandbox:latest', run_as_devin=False, max_iterations=100, max_budget_per_task=4, e2b_api_key='******', sandbox_type='ssh', use_host_network=True, ssh_hostname='localhost', disable_color=False, sandbox_user_id=501, sandbox_timeout=120, initialize_plugins=True, persist_sandbox=False, ssh_port=63710, ssh_password='******', jwt_secret='******', debug=True, enable_auto_lint=True

I get this warning:

2024-06-26 10:29:29,488 - opendevin.core.config - WARNING - Please upgrade to Docker Desktop 4.29.0 or later to use host network mode on macOS. See https://github.com/docker/roadmap/issues/238#issuecomment-2044688144 for more information.

and then the error:

2024-06-26 10:29:31,849 - concurrent.futures - ERROR - exception calling callback for <Future at 0x31e88ca90 state=finished raised DockerException>
concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    conn.request(
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connection.py", line 398, in request
    self.endheaders()
  File "/Users/jatinganhotra/miniforge3/lib/python3.11/http/client.py", line 1298, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/jatinganhotra/miniforge3/lib/python3.11/http/client.py", line 1058, in _send_output
    self.send(msg)
  File "/Users/jatinganhotra/miniforge3/lib/python3.11/http/client.py", line 996, in send
    self.connect()
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/docker/transport/unixconn.py", line 26, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    conn.request(
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/urllib3/connection.py", line 398, in request
    self.endheaders()
  File "/Users/jatinganhotra/miniforge3/lib/python3.11/http/client.py", line 1298, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/jatinganhotra/miniforge3/lib/python3.11/http/client.py", line 1058, in _send_output
    self.send(msg)
  File "/Users/jatinganhotra/miniforge3/lib/python3.11/http/client.py", line 996, in send
    self.connect()
  File "/Users/jatinganhotra/Library/Caches/pypoetry/virtualenvs/opendevin-ePNozKmm-py3.11/lib/python3.11/site-packages/docker/transport/unixconn.py", line 26, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

Can someone provide instructions for running OpenDevin on MacOS using Podman?

Link to Slack thread: https://opendevin.slack.com/archives/C06U8UTKSAD/p1719412928720339

mamoodi commented 4 months ago

From the Slack thread, this doesn't seem to be supported right now?

Shimada666 commented 4 months ago

Maybe you can refer to this: https://docs.all-hands.dev/modules/usage/troubleshooting#unable-to-connect-to-docker It's way to resolve this problem in docker. You can check if Podman can do similar fix.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

andrewginns commented 2 months ago

Edit: Got it working with these steps.

  1. Find the podman.sock location
    podman info --format "{{.Host.RemoteSocket.Path}}"
    /run/user/502/podman/podman.sock
  2. Set permissions on podman.sock inside the podman machine
    
    podman machine ssh
    Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
    Fedora CoreOS 39.20240407.2.0
    Tracker: https://github.com/coreos/fedora-coreos-tracker
    Discuss: https://discussion.fedoraproject.org/tag/coreos

Last login: Fri Aug 16 19:18:33 2024 from 192.168.127.1 core@localhost:~$ sudo chmod 666 /run/user/502/podman/podman.sock core@localhost:~$ exit logout

3. Launch the container
```zsh
export DOCKER_HOST=unix:///run/user/502/podman/podman.sock

WORKSPACE_BASE=$(pwd)/workspace
docker run -it \
    --pull=always \
    --privileged \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base:z \
    -v /run/user/502/podman/podman.sock:/var/run/docker.sock:Z \
    -p 3005:3000 \
    --name opendevin-app-$(date +%Y%m%d%H%M%S) \
    ghcr.io/opendevin/opendevin:0.8

Original comment

I get an stat: cannot statx '/var/run/docker.sock': Permission denied error trying to use the following command with Podman installed on macOS (docker is aliased to podman).

WORKSPACE_BASE=$(pwd)/workspace
docker run -it \
    --pull=always \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 3001:3000 \
    --add-host host.docker.internal:10.88.0.1 \
    --name opendevin-app-$(date +%Y%m%d%H%M%S) \
    ghcr.io/opendevin/opendevin:0.8

My Podman machine info is

host:
    arch: arm64
    currentmachine: podman-machine-default
    defaultmachine: podman-machine-default
    eventsdir: /var/folders/w6/pt8s56x53cgffnn66mrrj26r0000gp/T/storage-run-502/podman
    machineconfigdir: /Users/aginns/.config/containers/podman/machine/applehv
    machineimagedir: /Users/aginns/.local/share/containers/podman/machine/applehv
    machinestate: Running
    numberofmachines: 1
    os: darwin
    vmtype: applehv
version:
    apiversion: 5.2.0
    version: 5.2.0
    goversion: go1.22.5
    gitcommit: b22d5c61eef93475413724f49fd6a32980d2c746
    builttime: Thu Aug  1 18:32:02 2024
    built: 1722533522
    osarch: darwin/arm64
    os: darwin
andrewginns commented 1 month ago

After the update to OpenHands I had to apply the same sort of changes

export WORKSPACE_BASE=$(pwd)/workspace
export DOCKER_HOST=unix:///run/user/502/podman/podman.sock
docker run -it \
    --pull=always \
    --privileged \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.9-nikolaik \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base:z \
    -v /run/user/502/podman/podman.sock:/var/run/docker.sock:Z \
    -p 3008:3000 \
    --name openhands-app-$(date +%Y%m%d%H%M%S) \
    ghcr.io/all-hands-ai/openhands:latest

However I'm now stuck at "Initializing agent (may take up to 10 seconds)..."

Getting this terminal output:

Starting OpenHands...
Setting up enduser with id 502
Docker socket group id: 0
root:x:0:
Group with id 0 already exists
Running as enduser
INFO:     Started server process [31]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     10.88.0.22:45500 - "GET /api/options/models HTTP/1.1" 200 OK
INFO:     10.88.0.22:45500 - "GET /api/options/agents HTTP/1.1" 200 OK
INFO:     10.88.0.22:45500 - "GET /api/options/security-analyzers HTTP/1.1" 200 OK
INFO:     ('10.88.0.22', 45514) - "WebSocket /ws" [accepted]
INFO:     connection open
16:00:01 - openhands:INFO: agent.py:79 - Using security analyzer:
16:00:01 - openhands:INFO: agent.py:90 - Initializing runtime `eventstream` now...
16:00:01 - openhands:INFO: runtime.py:190 - Starting container with image: ghcr.io/all-hands-ai/runtime:0.9-nikolaik and name: openhands-sandbox-431a1af6-e01e-4777-b222-8d70fe476a3a_10102af3-e9e7-471f-96f8-8d4f4d3c9b53
16:00:01 - openhands:INFO: runtime.py:211 - Mount dir: /workspace
16:00:05 - openhands:ERROR: runtime.py:88 - Error streaming docker logs: 'LogBuffer' object has no attribute '_stop_event'
16:00:05 - openhands:INFO: runtime.py:245 - Container started. Server url: http://host.docker.internal:36607
tobitege commented 1 month ago

@andrewginns - Instead of openhands:latest in the last line of your docker command, please try openhands:0.9 instead? You may be running in an image version mismatch here. The first time the initialization can take several minutes due to image handling (< 10 minutes normally), afterwards it should be much faster.

andrewginns commented 1 month ago

@tobitege I tried that and now it hangs on "Agent is initialized, waiting for task...".

In my case docker is an alias to podman on my macOS Apple silicon machine.

podman machine info
host:
    arch: arm64
    currentmachine: podman-machine-default
    defaultmachine: podman-machine-default
    eventsdir: /var/folders/w6/pt8s56x53cgffnn66mrrj26r0000gp/T/storage-run-502/podman
    machineconfigdir: /Users/aginns/.config/containers/podman/machine/applehv
    machineimagedir: /Users/aginns/.local/share/containers/podman/machine/applehv
    machinestate: Running
    numberofmachines: 1
    os: darwin
    vmtype: applehv
version:
    apiversion: 5.2.2
    version: 5.2.2
    goversion: go1.23.0
    gitcommit: fcee48106a12dd531702d729d17f40f6e152027f
    builttime: Wed Aug 21 18:43:11 2024
    built: 1724262191
    osarch: darwin/arm64
    os: darwin
export WORKSPACE_BASE=$(pwd)/workspace
export DOCKER_HOST=unix:///run/user/502/podman/podman.sock
docker run -it \
    --pull=always \
    --privileged \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.9-nikolaik \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base:z \
    -v /run/user/502/podman/podman.sock:/var/run/docker.sock:Z \
    -p 3008:3000 \
    --name openhands-app-$(date +%Y%m%d%H%M%S) \
    ghcr.io/all-hands-ai/openhands:0.9

Send a "Hello" gives no response in chat and the terminal also doesn't respond to commands. Model was selected and API key added.

image
Starting OpenHands...
Setting up enduser with id 502
Docker socket group id: 0
root:x:0:
Group with id 0 already exists
Running as enduser
INFO:     Started server process [31]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     10.88.0.26:41206 - "GET / HTTP/1.1" 200 OK
INFO:     10.88.0.26:41206 - "GET /api/options/models HTTP/1.1" 200 OK
INFO:     10.88.0.26:41206 - "GET /favicon-32x32.png HTTP/1.1" 304 Not Modified
INFO:     10.88.0.26:41206 - "GET /api/options/agents HTTP/1.1" 200 OK
INFO:     10.88.0.26:41206 - "GET /api/options/security-analyzers HTTP/1.1" 200 OK
INFO:     ('10.88.0.26', 54690) - "WebSocket /ws" [accepted]
INFO:     connection open
10:44:48 - openhands:INFO: agent.py:79 - Using security analyzer:
10:44:48 - openhands:INFO: agent.py:90 - Initializing runtime `eventstream` now...
10:44:48 - openhands:INFO: runtime.py:190 - Starting container with image: ghcr.io/all-hands-ai/runtime:0.9-nikolaik and name: openhands-sandbox-c7e88b0f-fe8a-4e99-b224-c7bb685ac6ca_129086a2-be52-446a-9d03-6792a5e59248
10:44:48 - openhands:INFO: runtime.py:211 - Mount dir: /workspace
10:44:52 - openhands:ERROR: runtime.py:88 - Error streaming docker logs: 'LogBuffer' object has no attribute '_stop_event'
10:44:52 - openhands:INFO: runtime.py:245 - Container started. Server url: http://host.docker.internal:58857
10:44:57 - openhands:INFO: runtime.py:164 - Container initialized with plugins: ['agent_skills', 'jupyter']
10:44:57 - openhands:INFO: runtime.py:167 - Container initialized with env vars: None
10:44:57 - openhands:INFO: agent.py:116 - Agents: {'agent': AgentConfig(micro_agent_name=None, memory_enabled=False, memory_max_threads=2, llm_config=None)}
10:44:57 - openhands:INFO: agent.py:117 - Creating agent CodeActAgent using LLM gpt-4o-mini
10:44:57 - openhands:ERROR: state.py:118 - Failed to restore state from session: sessions/c7e88b0f-fe8a-4e99-b224-c7bb685ac6ca/agent_state.pkl
10:44:57 - openhands:INFO: agent.py:139 - Error restoring state: sessions/c7e88b0f-fe8a-4e99-b224-c7bb685ac6ca/agent_state.pkl
10:44:57 - openhands:INFO: agent.py:140 - Agent controller initialized.
10:44:57 - openhands:INFO: session.py:139 - Server event
10:44:57 - openhands:INFO: agent_controller.py:150 - [Agent Controller c7e88b0f-fe8a-4e99-b224-c7bb685ac6ca] Starting step loop...
10:44:57 - openhands:INFO: session.py:139 - Server event
tobitege commented 1 month ago

The issue in the logs is this: Error streaming docker logs: 'LogBuffer' object has no attribute '_stop_event' First time I see this (I mean before today, it's in the previous log, too), and I think it is podman related as that clearly isn't happening with the docker client. Since the log buffer isn't running in the background, but it is essential to signal, whether the client has started, it is getting stuck.

Thanks for reporting this. We'll need to investigate if/how we can mitigate this. So I can't promise an immediate fix, so please bear with us! 🙏

tobitege commented 1 month ago

@andrewginns - We hope your issue is resolved now with the above mentioned merged PR. Give the repo like an hour time to have the latest image with it uploaded to the container registry, then you could retry again (after removing "old" images on your machine)?

andrewginns commented 1 month ago

With old images removed I am still seeing the Error streaming docker logs error when I launch the container, the UI also seems to hang and then on reload after a few minutes cannot be accessed.

docker images
REPOSITORY                      TAG                    IMAGE ID      CREATED        SIZE
localhost/cot_at_home           latest                 3bd75904a03f  2 days ago     250 MB
ghcr.io/opendevin/sandbox       main                   583abfa6b0ea  6 weeks ago    2.51 GB
<none>                          <none>                 d73098b8355e  8 weeks ago    1.39 GB
<none>                          <none>                 3fe553ecff82  8 weeks ago    1.39 GB
<none>                          <none>                 da5984d4fec8  8 weeks ago    1.11 GB
<none>                          <none>                 75d0d1336937  2 months ago   1.42 GB
<none>                          <none>                 f2b2eb9425c4  2 months ago   238 MB
<none>                          <none>                 7915b05a3249  3 months ago   1.12 GB
docker.io/library/python        3.10.13-bookworm       ea8c96ba521a  7 months ago   1.02 GB
docker.io/library/python        3.10.13-slim-bookworm  2e941c6bbd3f  7 months ago   133 MB
docker.io/library/python        3.11-slim-buster       12cacc23b6de  15 months ago  119 MB

Starting container with podman aliased to docker

export WORKSPACE_BASE=$(pwd)/workspace
export DOCKER_HOST=unix:///run/user/502/podman/podman.sock
docker run -it \
    --pull=always \
    --privileged \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.9-nikolaik \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base:z \
    -v /run/user/502/podman/podman.sock:/var/run/docker.sock:Z \
    -p 3008:3000 \
    --name openhands-app-$(date +%Y%m%d%H%M%S) \
    ghcr.io/all-hands-ai/openhands:0.9
Trying to pull ghcr.io/all-hands-ai/openhands:0.9...
Getting image source signatures
Copying blob sha256:a61bfcb658995ad22f02abcb12648e3204c479f65b34c2f3bafe4c951ef0a5ec
Copying blob sha256:e7a4e341340569c40f528bc3e6736ff553f08b2257f09cc03fd031a9d4c50f75
Copying blob sha256:bde8cdf335c33fedbeffaa20726f41545c3086e9acae3bc97fcd0cc0665ab01c
Copying blob sha256:878f5f58be8973494a4edadf48747d94498e0a362e2b336e137ccac3421e11ce
Copying blob sha256:ebf1025c057db66150ab28473651af3f5c63d65c7c7db18621417ca6276ac0d2
Copying blob sha256:24c63b8dcb66721062f32b893ef1027404afddd62aade87f3f39a3a6e70a74d0
Copying blob sha256:532c5a4edb905c02a4dc2d228f34369209ced95c7ec3073e6107994d8a6003c7
Copying blob sha256:bce9179f53b44989fa0765de26f9363e9ce2df1feedf8cab564dc3f0bf0200e5
Copying blob sha256:2b753c7f8b8c6de2fab7e2f9a787d9a9e55ab1a0bbed055f1d3396fbb5831a47
Copying blob sha256:9e678fbd75afa8ea3f774b05f9d719df35762bdfa556c8354019bb6e0e5f5db7
Copying blob sha256:d25ae016e0d78ce837bea888bc1fce3957bb26e0817b3e41759c7cc1b8939d86
Copying blob sha256:47df236e50dd6b531591bd2cbb846f21967fe52accdcc74fc7f12bfd3b0a96c8
Copying blob sha256:eb6a91c8c36bde0c4f0da1e976d75416752abcc3ffcc41020f6538f3d6283097
Copying blob sha256:f1fd473c6ecf2d9893a591d8da8e27643c4018527a39a0c422eff84f8197484b
Copying blob sha256:9ae23e882de7f793a67cfb3600d5e38486ac6f2aa85e57009b098fbdebd63a69
Copying blob sha256:d84def5c000fb26d8ba8759b34390f0df5de9d86f2ad136433bf7ceeb71c8922
Copying blob sha256:9662910fdc9f9ed350c70688613bca27bea740e5a43e45ed8ae8d443ccfde5ff
Copying blob sha256:04de7abb360104f85c559da4a2249e4c3318bb2e9122eff7265a8412c3612ce1
Copying blob sha256:2eb50cbef5129b91bf88d67f50c2cbe6e2e11a01768c8f9d515df04cdd0d0e5a
Copying blob sha256:3e05e819f8b578030b22b9837cec4f634d769b523aa0f8135ab3910e8302bcc7
Copying blob sha256:e7a77cd6d3c0e58518bd01b174cd47202c69d4eb2b3c108d26c53df7cd93e840
Copying blob sha256:15a6192ad15f1a3c2e440ef96eb749088b5e91e422251d64572e24cbf09744d8
Copying blob sha256:1c735df404094716b917aadeace0f554ae50be0410611dbaed7e498de8b2cc99
Copying blob sha256:c90c443508dce212f8ebcef254a0c67c771ff26015c26fc6046fd062031ac745
Copying blob sha256:67f05d6e6356e5f9d5a371bf83df7fc087b4d1cfe57e99115cd6aae7f9781ecd
Copying blob sha256:cc3315c79a9685df101e13b179521b41714c19340e785eb96b86240f832d9e5b
Copying blob sha256:6bdc5c6e112eaa5a74d86ed0ee3bcbaebb6c1fe40a8d8ed55d3ad06236a3db35
Copying blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
Copying config sha256:d9ba1577c7ba780cac9edda67ad207ab2e5ed895613e5af2abd094b37a6b2997
Writing manifest to image destination
Starting OpenHands...
Setting up enduser with id 502
Docker socket group id: 0
root:x:0:
Group with id 0 already exists
Running as enduser
INFO:     Started server process [31]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     10.88.0.32:46834 - "GET /api/options/models HTTP/1.1" 200 OK
INFO:     10.88.0.32:46834 - "GET /api/options/agents HTTP/1.1" 200 OK
INFO:     10.88.0.32:46834 - "GET /api/options/security-analyzers HTTP/1.1" 200 OK
INFO:     ('10.88.0.32', 46838) - "WebSocket /ws" [accepted]
INFO:     connection open
08:39:44 - openhands:INFO: agent.py:79 - Using security analyzer:
08:39:44 - openhands:INFO: agent.py:90 - Initializing runtime `eventstream` now...
08:39:44 - openhands:INFO: runtime.py:190 - Starting container with image: ghcr.io/all-hands-ai/runtime:0.9-nikolaik and name: openhands-sandbox-bbd86d12-4ce8-49b4-a4af-7349f4311973_f9b2bb73-426f-4480-a781-9c392a9fdf9b
08:39:44 - openhands:INFO: runtime.py:211 - Mount dir: /workspace
08:40:58 - openhands:ERROR: runtime.py:88 - Error streaming docker logs: 'LogBuffer' object has no attribute '_stop_event'
08:40:58 - openhands:INFO: runtime.py:245 - Container started. Server url: http://host.docker.internal:42273
tobitege commented 1 month ago

The error message differs with the location in the current source, so there's (still) a version mismatch in the image (will need to confirm with the team later today).

I just tried this myself to get both the current images from the last merged commit:

andrewginns commented 1 month ago

@tobitege it hangs at the Agent is initialized, waiting for task... step. UI is unresponsive

image

Logs of container with podman aliased to docker

export WORKSPACE_BASE=$(pwd)/workspace
export DOCKER_HOST=unix:///run/user/502/podman/podman.sock
docker run -it \
    --pull=always \
    --privileged \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:main-nikolaik \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base:z \
    -v /run/user/502/podman/podman.sock:/var/run/docker.sock:Z \
    -p 3008:3000 \
    --name openhands-app-$(date +%Y%m%d%H%M%S) \
    ghcr.io/all-hands-ai/openhands:main
Trying to pull ghcr.io/all-hands-ai/openhands:main...
Getting image source signatures
Copying blob sha256:a61bfcb658995ad22f02abcb12648e3204c479f65b34c2f3bafe4c951ef0a5ec
Copying blob sha256:e7a4e341340569c40f528bc3e6736ff553f08b2257f09cc03fd031a9d4c50f75
Copying blob sha256:ebf1025c057db66150ab28473651af3f5c63d65c7c7db18621417ca6276ac0d2
Copying blob sha256:bde8cdf335c33fedbeffaa20726f41545c3086e9acae3bc97fcd0cc0665ab01c
Copying blob sha256:24c63b8dcb66721062f32b893ef1027404afddd62aade87f3f39a3a6e70a74d0
Copying blob sha256:878f5f58be8973494a4edadf48747d94498e0a362e2b336e137ccac3421e11ce
Copying blob sha256:104cce9aeb9b09ca10fa735d078dfd25b56911ae1304e7f18532c96c9e316491
Copying blob sha256:693ff73d4c8127d4c6887d95e09edfbe78b4ab61841eecdfb104e31f72558338
Copying blob sha256:54ad5fd3fbdad8d201a82199e05d1be451e2fa757a7620f4bb9f78c60bb658cf
Copying blob sha256:c3d6bd03db7a4462826c8f61871239db1a4116758eeabe3e4be2dac2da634bea
Copying blob sha256:d201aa3da1755bfcaa81dd423511b19396899d86a7db317187b5765fc7f50646
Copying blob sha256:fab71abb363ca1edd875a87d0ba5687240dfa533edfee1e7981648c92eb5a83c
Copying blob sha256:eb6a91c8c36bde0c4f0da1e976d75416752abcc3ffcc41020f6538f3d6283097
Copying blob sha256:f496afd7ea30186ade8ff7a859c6c0a2c0818aec572728f5ede93e6e9696c5c8
Copying blob sha256:d520a7e9986f526d8cb31e78fe75e9251d8d1efb8d646d6da60ac160fefadf73
Copying blob sha256:65540e70e290cccda21b49a5d9a36b2507ee7f95896d6caac439786279203444
Copying blob sha256:27ca8707d97e64856b2fb098b7c0df4e09b008e93212c95e72abd5bc600dc1fc
Copying blob sha256:461c68bc6df5142704c6efd5a8c5fded1ebeef6416d52c6ca8c38baa20bfbb48
Copying blob sha256:a5f623cb0c7e7f6cf93e887a2dd66ed3ff337a916dfde979407ced5fb861b965
Copying blob sha256:15f6b7a015780d8ac1bb9ac8c64346cde99ff515b5f27b62598bb08e76d13d16
Copying blob sha256:35f103c26b1e80c1dd4888c8e27f7ef1d37f07515f8867c83a2300a916c35045
Copying blob sha256:eaff19e39763b99b1f638db8d41f61e02178af26d44ce59c10c9e08b00b45159
Copying blob sha256:49cc3d09360f830d1e008f793d25067ce8af17ac61fb39d0dc22cf9448552492
Copying blob sha256:f0544b52e94cf83daa8a65095add4fe5d8386035e07fd3e05acf0c6d55ddcbd9
Copying blob sha256:c01f2bb8d6325afb62ae665aa607b7b3b81501baee13eacd515b6cebef027f2d
Copying blob sha256:580153524ef2c8f87c65a5a096ca6b65c2be3a440363c8b855f931b0d7ea23cd
Copying blob sha256:d30454a459729ea98e733e773c533e9b58aa3a8cdee0218c078bb94fca227cce
Copying blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
Copying config sha256:bc73fbfe51680cea58986c4b68762c9d4f1a28aad835d4f05e11b9e693cc8fe1
Writing manifest to image destination
Starting OpenHands...
Setting up enduser with id 502
Docker socket group id: 0
root:x:0:
Group with id 0 already exists
Running as enduser
INFO:     Started server process [31]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     10.88.0.36:33714 - "GET / HTTP/1.1" 200 OK
INFO:     10.88.0.36:33714 - "GET /api/options/models HTTP/1.1" 200 OK
INFO:     10.88.0.36:33714 - "GET /api/options/agents HTTP/1.1" 200 OK
INFO:     10.88.0.36:33714 - "GET /api/options/security-analyzers HTTP/1.1" 200 OK
INFO:     ('10.88.0.36', 33728) - "WebSocket /ws" [accepted]
INFO:     connection open
10:27:10 - openhands:INFO: agent.py:79 - Using security analyzer:
10:27:10 - openhands:INFO: agent.py:90 - Initializing runtime `eventstream` now...
10:27:10 - openhands:INFO: runtime.py:201 - Starting container with image: ghcr.io/all-hands-ai/runtime:main-nikolaik and name: openhands-sandbox-7327d65d-d147-4283-942b-dbd95a5e516d_370d8644-6b9f-409f-a32d-51f9f3e05561
10:27:10 - openhands:INFO: runtime.py:241 - Workspace Base: /opt/workspace_base
10:27:10 - openhands:INFO: runtime.py:245 - Mount dir: /Users/aginns/projects/OpenHands/workspace
10:27:10 - openhands:INFO: runtime.py:251 - Sandbox workspace: /workspace
10:28:23 - openhands:INFO: runtime.py:280 - Container started. Server url: http://host.docker.internal:35283
10:28:23 - openhands:INFO: runtime.py:174 - Container initialized with plugins: ['agent_skills', 'jupyter']
10:28:23 - openhands:INFO: runtime.py:177 - Container initialized with env vars: None
10:28:24 - openhands:INFO: agent.py:116 - Agents: {'agent': AgentConfig(micro_agent_name=None, memory_enabled=False, memory_max_threads=2, llm_config=None)}
10:28:24 - openhands:INFO: agent.py:117 - Creating agent CodeActAgent using LLM gpt-4o-mini
10:28:24 - openhands:ERROR: state.py:118 - Failed to restore state from session: sessions/7327d65d-d147-4283-942b-dbd95a5e516d/agent_state.pkl
10:28:24 - openhands:INFO: agent.py:139 - Error restoring state: sessions/7327d65d-d147-4283-942b-dbd95a5e516d/agent_state.pkl
10:28:24 - openhands:INFO: agent.py:140 - Agent controller initialized.
10:28:24 - openhands:INFO: session.py:140 - Server event
10:28:24 - openhands:INFO: agent_controller.py:151 - [Agent Controller 7327d65d-d147-4283-942b-dbd95a5e516d] Starting step loop...
10:28:24 - OBSERVATION
AgentStateChangedObservation(content='', agent_state=<AgentState.INIT: 'init'>, observation='agent_state_changed')
10:28:24 - openhands:INFO: session.py:140 - Server event
10:28:24 - OBSERVATION
NullObservation(content='', observation='null')
10:28:24 - openhands:INFO: runtime.py:306 -
-----------------------------------Container logs:-----------------------------------
    |10:28:23 - openhands:INFO: client.py:730 - Runtime client initialized.
    |10:28:23 - openhands:INFO: client.py:732 - Starting action execution API on port 35283
    |INFO:     Started server process [10]
    |INFO:     Waiting for application startup.
    |10:28:23 - openhands:INFO: client.py:137 - Client working directory: /workspace
    |10:28:23 - openhands:INFO: browser_env.py:59 - Starting browser env...
--------------------------------------------------------------------------------
tobitege commented 1 month ago

Ok, so we're now beyond the first error message at least. 😄 The browsing environment should not take longer than like 10 seconds, and I don't know why that is hanging now. It could be related to MacOs as a host system, but I'd need to ask the team with that OS, if they have experienced this.

Which exact version is this on your machine and what kind of hardware?

andrewginns commented 1 month ago

I let my machine sit for at least 10 minutes before interactive with the localhost web url.

Apple M3 Pro, 36 GB macOS 14.7 (23H124)

Not running in a CPU or memory constrained state.

Podman virtual machine info:

host:
    arch: arm64
    currentmachine: podman-machine-default
    defaultmachine: podman-machine-default
    eventsdir: /var/folders/w6/pt8s56x53cgffnn66mrrj26r0000gp/T/storage-run-502/podman
    machineconfigdir: /Users/aginns/.config/containers/podman/machine/applehv
    machineimagedir: /Users/aginns/.local/share/containers/podman/machine/applehv
    machinestate: Running
    numberofmachines: 1
    os: darwin
    vmtype: applehv
version:
    apiversion: 5.2.2
    version: 5.2.2
    goversion: go1.23.0
    gitcommit: fcee48106a12dd531702d729d17f40f6e152027f
    builttime: Wed Aug 21 18:43:11 2024
    built: 1724262191
    osarch: darwin/arm64
    os: darwin

podman stats

ID            NAME                                                                                         CPU %       MEM USAGE / LIMIT  MEM %       NET IO             BLOCK IO           PIDS        CPU TIME       AVG CPU %
1e753d61dfb7  openhands-app-20240919112311                                                                 0.00%       231.3MB / 8.301GB  2.79%       20.15kB / 3.692kB  618.5kB / 5.238MB  10          3.274476s      0.07%
7abbdd576b85  openhands-sandbox-7327d65d-d147-4283-942b-dbd95a5e516d_370d8644-6b9f-409f-a32d-51f9f3e05561  1.92%       686.7MB / 8.301GB  8.27%       1.636kB / 1.258kB  211.1MB / 53.84MB  162         1m35.16303s    2.23%
tobitege commented 1 month ago

Thanks for the extra details!

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for over 30 days with no activity.