OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: workspace vs workspace_base issue?

Open williambarberjr opened this issue 1 year ago • 11 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

When the codeact agent tries to write jupyter code and runs it, I get the error: bash: line 1: /workspace/.tmp/.ipython_execution_tmp.py: No such file or directory

When I look at the "code editor" tab, the .tmp/.ipython_execution_tmp.py is there but under workspace_base image

My guess is that's the issue?

Current Version

opendevin:0.5

Installation and Configuration

Doesn't seem to matter how I run it but this is my current starting command:
export LLM_API_KEY="..."
export LLM_MODEL="..."
export LLM_BASE_URL="..."
export WORKSPACE_BASE=$(pwd)/open_devin_test

sudo docker run \
    -e LLM_API_KEY \
    -e LLM_MODEL \
    -e LLM_BASE_URL \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -e SANDBOX_TYPE=exec \
    -v $WORKSPACE_BASE:/opt/workspace_base \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 3000:3000 \
    --add-host host.docker.internal:host-gateway \
    ghcr.io/opendevin/opendevin:0.5

I'm running this within wsl2 on windows

Model and Agent

Behavior doesn't vary by model, have only ever tried it with the code act agent

Reproduction Steps

  1. Launch open devin
  2. Prompt it to write python code
  3. Get error

Logs, Errors, Screenshots, and Additional Context

image

williambarberjr avatar May 08 '24 20:05 williambarberjr

@williambarberjr what do you get if you run ls -lah $(pwd)/open_devin_test

rbren avatar May 10 '24 02:05 rbren

any solution? i have the same problem

umbes18 avatar May 10 '24 14:05 umbes18

@rbren image

SmartManoj avatar May 10 '24 15:05 SmartManoj

image but no files in the container.

OS: wsl

SmartManoj avatar May 10 '24 15:05 SmartManoj

Screenshot 2024-05-10 alle 18 02 04 Screenshot 2024-05-10 alle 18 02 11

i have always these problems

I'm running this on Mac m1 `export WORKSPACE_BASE=$(pwd)/workspace;

docker run
--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 3000:3000
--add-host host.docker.internal:host-gateway
ghcr.io/opendevin/opendevin:0.5`

why does no files and directories appear in the code editor when I give a prompt ?

umbes18 avatar May 10 '24 16:05 umbes18

@williambarberjr what do you get if you run ls -lah $(pwd)/open_devin_test

ls -lah $(pwd)/open_devin_test
total 12K
drwxr-xr-x  3 myusername myusername 4.0K May 10 13:58 .
drwxr-x--- 27 myusername myusername 4.0K May 10 14:03 ..
drwxr-xr-x  2 myusername           42421 4.0K May  8 15:25 .tmp

There's nothing inside my open_devin_test folder, it's just an empty dir.

The full print out from the WSL2 console:

==============
STEP 0

18:01:34 - PLAN
run hello world in the ipython notebook
18:01:37 - ACTION
**IPythonRunCellAction**
THOUGHT:Sure, let's run a simple "Hello World!" in the IPython notebook environment:
CODE:
print("Hello World!")
18:01:37 - OBSERVATION
IPythonRunCellObservation(content='bash: line 1: /workspace/.tmp/.ipython_execution_tmp.py: No such file or directory', code='print("Hello World!")', observation='run_ipython')


==============
STEP 1

18:01:40 - ACTION
**IPythonRunCellAction**
THOUGHT:It seems there was an issue with the execution environment. Let me try running the "Hello World!" command again for you.
CODE:
print("Hello World!")
18:01:40 - OBSERVATION
IPythonRunCellObservation(content='bash: line 1: /workspace/.tmp/.ipython_execution_tmp.py: No such file or directory', code='print("Hello World!")', observation='run_ipython')


==============
STEP 2

18:01:46 - ACTION
It appears there is a persistent issue with the IPython notebook execution environment. Unfortunately, I can't directly resolve this environment setup issue from here. However, you can try running the Python code locally on your machine or in any online Python compiler. Here's the code you would use:

\```python
print("Hello World!")
\```

You can simply copy this into your Python environment and run it to see the output. If you have any other questions or need further assistance with a different task, feel free to ask!
18:01:46 - opendevin:INFO: agent_controller.py:201 - Setting agent state from AgentState.RUNNING to AgentState.AWAITING_USER_INPUT

When I go to docker desktop, click the vertical ... and "open in terminal" then poked around with these commands and results:

# pwd
/workspace
# ls
open_devin_test
# cd ..
# ls
bin  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  opendevin  opt  proc  root  run  sbin  srv  sys  tmp  usr  var  workspace
# cd opt 
# ls
# pwd
/opt
#

In other words, when looking inside the docker container for the sandbox, I don't see any subfolders inside /opt, so I'm not sure how it's supposed to handle the volume mapping requested with this -v flag: -v $WORKSPACE_BASE:/opt/workspace_base

My WSL2 env is Ubuntu 22.04.4 LTS if it matters and I'm running this on Windows 11 Pro. But generally I think the point of Docker is those details shouldn't be as consequential...

williambarberjr avatar May 10 '24 18:05 williambarberjr

@rbren Shouldn't open_devin_test folder be mapped to /workspace in sandbox?

@williambarberjr What happens if you set export WORKSPACE_BASE=$(pwd)/workspace;?

SmartManoj avatar May 11 '24 02:05 SmartManoj

@williambarberjr Could you check the main version?

SmartManoj avatar May 11 '24 12:05 SmartManoj

@williambarberjr What happens if you set export WORKSPACE_BASE=$(pwd)/workspace;?

If I understand what the -v volume flag is doing in the docker run command, I believe doing that would just try to map a) the result of concatenating my current working directory with /workspace (a directory which doesn't exist on my local machine) to b) /opt/workspace_base within the docker container (which also doesn't exist within the docker container)

So I don't think that will solve anything unless I'm missing something...

williambarberjr avatar May 12 '24 00:05 williambarberjr

How did open_devin_test folder come inside the workspace directory? is that a nested folder? image

SmartManoj avatar May 12 '24 05:05 SmartManoj

a directory which doesn't exist on my local machine

The following line will automatically create it. https://github.com/OpenDevin/OpenDevin/blob/8bfae8413e74e1b6095d5380a7ea93b6b73a4537/containers/app/Dockerfile#L42

Duplicate of #1366

SmartManoj avatar May 12 '24 13:05 SmartManoj

I'm going to dedupe this with https://github.com/OpenDevin/OpenDevin/issues/1366

This is weird stuff, it seems to only pop up for a few folks. I will put more info in #1366 if anyone is able to help debug further

rbren avatar May 14 '24 17:05 rbren