All-Hands-AI / OpenHands

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

[Bug]: ERROR: agent.py:125 - Error creating controller: Failed to initialize plugin jupyter with exit code 126 and output -bash: /opendevin/plugins/jupyter/setup.sh #1747

Closed unclemusclez closed 4 months ago

unclemusclez commented 4 months ago

Is there an existing issue for the same bug?

Describe the bug

Compiled from source:

16:35:44 - opendevin:INFO: browser_env.py:38 - Starting browser env...
16:35:45 - opendevin:INFO: mixin.py:28 - Copied files from [/mnt/p/OpenDevin/opendevin/runtime/plugins/jupyter] to [/opendevin/plugins/jupyter] inside sandbox.
16:35:45 - opendevin:INFO: mixin.py:36 - Initializing plugin [jupyter] by executing [/opendevin/plugins/jupyter/setup.sh] in the sandbox.
16:35:45 - opendevin:ERROR: agent.py:125 - Error creating controller: Failed to initialize plugin jupyter with exit code 126 and output -bash: /opendevin/plugins/jupyter/setup.sh: /bin/bash^M: bad interpreter: No such file or directory
Traceback (most recent call last):
  File "/mnt/p/OpenDevin/opendevin/server/agent/agent.py", line 117, in create_controller
    self.controller = AgentController(
                      ^^^^^^^^^^^^^^^^
  File "/mnt/p/OpenDevin/opendevin/controller/agent_controller.py", line 93, in __init__
    self.runtime.init_sandbox_plugins(agent.sandbox_plugins)
  File "/mnt/p/OpenDevin/opendevin/runtime/runtime.py", line 68, in init_sandbox_plugins
    self.sandbox.init_plugins(plugins)
  File "/mnt/p/OpenDevin/opendevin/runtime/plugins/mixin.py", line 41, in init_plugins
    raise RuntimeError(
RuntimeError: Failed to initialize plugin jupyter with exit code 126 and output -bash: /opendevin/plugins/jupyter/setup.sh: /bin/bash^M: bad interpreter: No such file or directory
16:35:45 - opendevin:INFO: agent_controller.py:201 - Setting agent(CodeActAgent) state from AgentState.LOADING to AgentState.INIT
INFO:     127.0.0.1:41894 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     127.0.0.1:41898 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     127.0.0.1:41894 - "GET /api/agents HTTP/1.1" 200 OK
Process Process-1:
Traceback (most recent call last):
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-dnzq0gtc-py3.11/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 802, in make
    env = env_creator(**env_spec_kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-dnzq0gtc-py3.11/lib/python3.11/site-packages/browsergym/core/registration.py", line 24, in <lambda>
    entry_point=lambda *env_args, **env_kwargs: BrowserEnv(task_class, *env_args, **env_kwargs),
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BrowserEnv.__init__() got an unexpected keyword argument 'start_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/mnt/p/OpenDevin/opendevin/runtime/browser/browser_env.py", line 43, in browser_process
    env = gym.make(
          ^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-dnzq0gtc-py3.11/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 814, in make
    raise type(e)(
TypeError: BrowserEnv.__init__() got an unexpected keyword argument 'start_url' was raised from the environment creator for browsergym/openended with kwargs ({'start_url': 'about:blank', 'wait_for_user_message': False, 'headless': True})
16:36:25 - opendevin:INFO: session.py:40 - WebSocket disconnected, sid: c24c9fda-76b3-4352-8a9f-6c96efe1adf7
INFO:     connection closed
Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/mnt/p/OpenDevin/opendevin/runtime/browser/browser_env.py", line 43, in browser_process
    env = gym.make(
          ^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-dnzq0gtc-py3.11/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 814, in make
    raise type(e)(
TypeError: BrowserEnv.__init__() got an unexpected keyword argument 'start_url' was raised from the environment creator for browsergym/openended with kwargs ({'start_url': 'about:blank', 'wait_for_user_message': False, 'headless': True})

Current Version

ghcr.io/opendevin/sandbox:main

Installation and Configuration

config.toml:
[core]
workspace_base="./workspace"
WORKSPACE_DIR="$(pwd)/workspace"

[llm]
model="ollama/deepseek-coder:33b-instruct"
api_key="ollama"
base_url="http://localhost:11434"
embedding_model="local"


### Model and Agent

deepseek-coder:33b-instruct

### Reproduction Steps

I've tried this with docker and docker-ce, same error. 

### Logs, Errors, Screenshots, and Additional Context

_No response_
xingyaoww commented 4 months ago

File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-dnzq0gtc-py3.11/lib/python3.11/site-packages/browsergym/core/registration.py", line 24, in entry_point=lambda *env_args, *env_kwargs: BrowserEnv(task_class, env_args, **env_kwargs), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: BrowserEnv.init() got an unexpected keyword argument 'start_url'

Looks like the issue has something to do with extra keyword argument -- do you mind sharing your config.toml with API key removed?

unclemusclez commented 4 months ago

it's there

xingyaoww commented 4 months ago

What's the version of the container you used for docker run? Or are you make build from the main?

unclemusclez commented 4 months ago

i am using make build from the main repository

i think i am seeing two issues in my logs: 1) i perhaps added too many variables for WORKSPACE_DIR/workspace_base, not sure if i need both, or just workspace_base. I was reading older documentation/Q&A trying to figure things out/messing things up. 2) some of my dependencies with pypoetry might be messed up

i'll try to rebuild from scratch

reteps commented 4 months ago

It looks like a bug in BrowserGym.

reteps commented 4 months ago

Looks like that argument needs to be task_kwargs={'start_url':'about:blank'}, once https://github.com/ServiceNow/BrowserGym/pull/11 is merged.

        env = gym.make(
            'browsergym/openended',
            task_kwargs={'start_url':'about:blank'},
            wait_for_user_message=False,
            headless=True,
            disable_env_checker=True,
        )
iFurySt commented 4 months ago

i got the same error after pull the latest commits.

unclemusclez commented 4 months ago

Looks like that argument needs to be task_kwargs={'start_url':'about:blank'}, once ServiceNow/BrowserGym#11 is merged.

        env = gym.make(
            'browsergym/openended',
            task_kwargs={'start_url':'about:blank'},
            wait_for_user_message=False,
            headless=True,
            disable_env_checker=True,
        )

Running pip install ./BrowserGym on your repo with the patch on /OpenDevin/opendevin/runtime/browser/browser_env.py worked

SmartManoj commented 4 months ago

For the plugin error

/bin/bash^M: bad interpreter:

^M is \r Change CLRF to LF line endings

Git replacing LF with CRLF

SmartManoj commented 4 months ago

Looks like that argument needs to be task_kwargs={'start_url':'about:blank'}, once ServiceNow/BrowserGym#11 is merged.

        env = gym.make(
            'browsergym/openended',
            task_kwargs={'start_url':'about:blank'},
            wait_for_user_message=False,
            headless=True,
            disable_env_checker=True,
        )

That merge is not needed.

rbren commented 4 months ago

the start_url issue has been fixed now by pinning to an old version. @SmartManoj has the correct fix above though