OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[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

Open unclemusclez opened this issue 9 months ago • 4 comments

Is there an existing issue for the same bug?

  • [X] I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
  • [X] I have checked the existing issues.

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_

unclemusclez avatar May 12 '24 21:05 unclemusclez

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?

xingyaoww avatar May 12 '24 21:05 xingyaoww

it's there

unclemusclez avatar May 12 '24 21:05 unclemusclez

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

xingyaoww avatar May 12 '24 21:05 xingyaoww

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

unclemusclez avatar May 12 '24 22:05 unclemusclez

It looks like a bug in BrowserGym.

reteps avatar May 13 '24 02:05 reteps

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,
        )

reteps avatar May 13 '24 02:05 reteps

i got the same error after pull the latest commits.

iFurySt avatar May 13 '24 03:05 iFurySt

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

unclemusclez avatar May 13 '24 06:05 unclemusclez

For the plugin error

/bin/bash^M: bad interpreter:

^M is \r Change CLRF to LF line endings

Git replacing LF with CRLF

SmartManoj avatar May 13 '24 06:05 SmartManoj

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.

SmartManoj avatar May 14 '24 11:05 SmartManoj

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

rbren avatar May 14 '24 18:05 rbren