OpenHands
OpenHands copied to clipboard
It seems that playwright isn't installed correctly in docker
Describe the bug
Opendevin tried to use playwright to browser online, but failed because playwright isn't installed correctly in docker.
playwright install command runned, but failed.(see screenshot below)
Setup and configuration
Current version:
I'm using the latest docker image.
My operating system: MacOS (M1 Max chip)
My environment vars and other configuration (be sure to redact API keys):
export WORKSPACE_DIR=/Users/fufu/codes/playgruond/workspace4opendevin/test_project
export LLM_API_KEY="sk-non-important"
export LLM_BASE_URL="https://someproxydomain2openai.com/v1"
My model and agent (you can see these settings in the UI):
- Model: GPT3.5
- Agent: MonologueAgent
Commands I ran to install and run OpenDevin:
docker run \
-e LLM_API_KEY=$LLM_API_KEY \
-e LLM_BASE_URL=$LLM_BASE_URL \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_DIR \
-v $WORKSPACE_DIR:/opt/workspace_base \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \
ghcr.io/opendevin/opendevin:latest
Steps to Reproduce:
- Create a pixel style RPG game.
Logs, error messages, and screenshots:
ACTION:
BrowseURLAction(url='https://www.pixelart.com/', action=<ActionType.BROWSE: 'browse'>)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
OBSERVATION:
BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1112/chrome-linux/chrome
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ playwright install ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════╝
Additional Context
I think this is caused by PATH env didn't set correctly in docker. Maybe try python -m playwright install ?
I think I've solved the problem by running command playwright install-deps mannually in docker exec (docker image version: opendevin:latest)
Good catch! We probably just need to add that command here: https://github.com/OpenDevin/OpenDevin/blob/main/containers/app/Dockerfile
Please add RUN npx -y [email protected] install --with-deps to line 53 in containers/app/Dockerfile then rebuild image to help check if this fix the problem.
@Umpire2018 I think that's for interacting using node.
@rben after 27?https://github.com/OpenDevin/OpenDevin/blob/aed82704a947df6e348a5fcf044c482f8e580f5f/containers/app/Dockerfile#L27
@Umpire2018 I think that's for interacting using node.
@SmartManoj I believe it's to install playwright system-wide. Below is its suggestion for your reference.
Most likely both python and npm can be used to install playwright globally. Since we're calling playwright from python, we should probably use that one.
@SmartManoj yeah I think you found the best spot for it
In the original issue at the top, the agent is trying to access Playwright. Does that not mean Playwright needs to be installed on the sandbox image rather than the app image?
If it does go in the app image, it should be in the runtime stage, so perhaps closer to line # 40
BrowseURLAction is happening on the app image. The command should be run only once. So, it should be in the backend-builder. right?
The OP installed it in the sandbox itself. It works like the other shell commands instead of a separate action.
The OP installed it in the sandbox itself.
It's the Agent that is trying to install playwright (and failing), rather than the OP.
BrowseURLAction is happening on the app image.
👍 did not know that. Someone needs to tell the agent that there's a BrowseURLAction it can use instead of installing playwright. Perhaps in the system prompt.
The command should be run only once. So, it should be in the backend-builder. right?
if you install it in the backend-builder, it wont make it to the final image, unless if you're explicitly copying it over. "runtime" doesn't mean it'll get run everytime the image is launched. see: https://docs.docker.com/build/building/multi-stage/
I think this is what happened:
- agent issues a
browseaction - backend (not sandbox) tries to run playwright
- backend reports an error "playwright not installed" to the agent
- agent tries to run
install playwrightin the sandbox- but obviously that won't fix the issue, because it's the backend that needs access to the command
The OP installed it in the sandbox itself.
@foragerr Manually using the docker GUI
, unless if you're explicitly copying it over.
https://github.com/OpenDevin/OpenDevin/blob/aed82704a947df6e348a5fcf044c482f8e580f5f/containers/app/Dockerfile#L46
Here, it is already copied for poetry packages. Right?
Could be, give it a try.
can anyone try https://github.com/OpenDevin/OpenDevin/pull/1184 to see if it works?
Should be fixed by https://github.com/OpenDevin/OpenDevin/pull/1184