Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Remove Playwright/Patchright dependencies - use uvx playwright install for browser only
Magnus Müller657ea42efd40
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yamlindex 6621a5ad3..b4be461fb 100644--- a/.github/workflows/test.yaml+++ b/.github/workflows/test.yaml@@ -77,33 +77,15 @@ jobs:- run: uv sync --dev --all-extras- - name: Detect installed Playwright version- run: echo "PLAYWRIGHT_VERSION=$(uv pip list --format json | jq -r '.[] | select(.name == "playwright") | .version')" >> $GITHUB_ENV-- - name: Cache chrome binaries- uses: actions/cache@v4- with:- path: |- /tmp/google-chrome-stable_current_amd64.deb- key: ${{ runner.os }}-${{ runner.arch }}-chrome-stable-- - name: Install Chrome stable binary- run: |- sudo apt-get update -qq \- && sudo curl -o "/tmp/google-chrome-stable_current_amd64.deb" --no-clobber "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" \- && sudo apt-get install -y "/tmp/google-chrome-stable_current_amd64.deb" -f- - run: patchright install chrome --with-deps- # - run: playwright install chrome --with-deps-- name: Cache chromium binariesuses: actions/cache@v4with:path: |~/.cache/ms-playwright- key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-chromium+ key: ${{ runner.os }}-${{ runner.arch }}-chromium-browser- - run: playwright install chromium --with-deps- # - run: patchright install chromium --with-deps+ - name: Install Chromium browser+ run: uvx playwright install chromium --with-deps --no-shell- name: Cache browser-use extensionsuses: actions/cache@v4@@ -137,33 +119,15 @@ jobs:- run: uv sync --dev --all-extras- - name: Detect installed Playwright version- run: echo "PLAYWRIGHT_VERSION=$(uv pip list --format json | jq -r '.[] | select(.name == "playwright") | .version')" >> $GITHUB_ENV-- - name: Cache chrome binaries- uses: actions/cache@v4- with:- path: |- /tmp/google-chrome-stable_current_amd64.deb- key: ${{ runner.os }}-${{ runner.arch }}-chrome-stable-- - name: Install Chrome stable binary- run: |- sudo apt-get update -qq \- && sudo curl -o "/tmp/google-chrome-stable_current_amd64.deb" --no-clobber "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" \- && sudo apt-get install -y "/tmp/google-chrome-stable_current_amd64.deb" -f- - run: patchright install chrome --with-deps- - run: playwright install chrome --with-deps-- name: Cache chromium binariesuses: actions/cache@v4with:path: |~/.cache/ms-playwright- key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-chromium+ key: ${{ runner.os }}-${{ runner.arch }}-chromium-browser- - run: playwright install chromium --with-deps- - run: patchright install chromium --with-deps+ - name: Install Chromium browser+ run: uvx playwright install chromium --with-deps --no-shell- name: Cache browser-use extensionsuses: actions/cache@v4diff --git a/Dockerfile b/Dockerfileindex 84f0ab961..504873b58 100644--- a/Dockerfile+++ b/Dockerfile@@ -153,28 +153,22 @@ RUN --mount=type=cache,target=/root/.cache,sharing=locked,id=cache-$TARGETARCH$T&& python --version \) | tee -a /VERSION.txt-# Install playwright using pip (with version from pyproject.toml)+# Install playwright temporarily for browser installation onlyRUN --mount=type=cache,target=/root/.cache,sharing=locked,id=cache-$TARGETARCH$TARGETVARIANT \- echo "[+] Installing playwright via pip using version from pyproject.toml..." \+ echo "[+] Installing playwright temporarily for browser installation..." \&& ( \- PLAYWRIGHT_VERSION=$(grep -E "playwright>=" pyproject.toml | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" | head -1) \- && PATCHRIGHT_VERSION=$(grep -E "patchright>=" pyproject.toml | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" | head -1) \- && echo "Installing playwright==$PLAYWRIGHT_VERSION patchright==$PATCHRIGHT_VERSION" \- && uv pip install playwright==$PLAYWRIGHT_VERSION patchright==$PATCHRIGHT_VERSION \- && which playwright \- && playwright --version \+ uvx --from playwright playwright --version \&& echo -e '\n\n' \) | tee -a /VERSION.txt-# Install Chromium using playwright+# Install Chromium using uvx playwrightRUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$TARGETVARIANT \--mount=type=cache,target=/root/.cache,sharing=locked,id=cache-$TARGETARCH$TARGETVARIANT \echo "[+] Installing chromium apt pkgs and binary to /root/.cache/ms-playwright..." \&& apt-get update -qq \- && playwright install --with-deps --no-shell chromium \- # && playwright install --with-deps chrome \+ && uvx playwright install chromium --with-deps --no-shell \&& rm -rf /var/lib/apt/lists/* \- && export CHROME_BINARY="$(python -c 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)')" \+ && export CHROME_BINARY="$(uvx --from playwright python -c 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)')" \&& ln -s "$CHROME_BINARY" /usr/bin/chromium-browser \&& ln -s "$CHROME_BINARY" /app/chromium-browser \&& mkdir -p "/home/${BROWSERUSE_USER}/.config/chromium/Crash Reports/pending/" \diff --git a/docker/base-images/chromium/Dockerfile b/docker/base-images/chromium/Dockerfileindex 1c2ff1d07..5b1846da1 100644--- a/docker/base-images/chromium/Dockerfile+++ b/docker/base-images/chromium/Dockerfile@@ -4,13 +4,11 @@ FROM browseruse/base-system:${BASE_TAG}WORKDIR /tmpCOPY pyproject.toml ./-# Install both playwright and patchright with versions from pyproject.toml+# Install chromium browser using uvx playwright (no permanent playwright dependency)RUN --mount=type=cache,target=/root/.cache,sharing=locked \- PLAYWRIGHT_VERSION=$(grep -E "playwright>=" pyproject.toml | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" | head -1) && \- PATCHRIGHT_VERSION=$(grep -E "patchright>=" pyproject.toml | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" | head -1) && \- echo "Installing playwright==$PLAYWRIGHT_VERSION patchright==$PATCHRIGHT_VERSION" && \- pip install --no-cache-dir playwright==$PLAYWRIGHT_VERSION patchright==$PATCHRIGHT_VERSION && \- PLAYWRIGHT_BROWSERS_PATH=/opt/playwright playwright install --with-deps --no-shell chromium && \+ echo "Installing chromium browser via uvx playwright..." && \+ pip install --no-cache-dir uv && \+ PLAYWRIGHT_BROWSERS_PATH=/opt/playwright uvx playwright install chromium --with-deps --no-shell && \ln -s /opt/playwright/chromium-*/chrome-linux/chrome /usr/bin/chromium-browser && \chmod -R 755 /opt/playwright && \rm -f pyproject.toml