Closed AngeloChecked closed 2 days ago
@AngeloChecked Are you running in docker? Any other details? The more information you can share, the better. Following the "Bug" issue template would be ideal!
oh, sorry!
version: 1.49.0
Expected Behavior: When attempting to open an HTML file using the Playwright Python library, it should generate a screenshot of the HTML using Chromium.
Actual behavior:
The library crashes with the following message:
Executable doesn't exist at /root/.cache/ms-playwright/chromium-1140/chrome-linux/chrome
It also displays a prompt:
Looks like Playwright was just installed or updated.
Please run the following command to download new browsers: playwright install
However, running playwright install
does not resolve the issue.
Additional context
the playwright is executed inside docker
the python library is playwright = "^1.48.0"
My computer is a MacBook Pro with an M1 ARM processor.
Environment Here’s a heavily simplified and anonymized version of the Dockerfile:
ARG APP_NAME=app
ARG APP_PATH=/opt/$APP_NAME
ARG PYTHON_VERSION=3.11.3
ARG POETRY_VERSION=1.4.2
FROM python:3.11-slim-bullseye AS base
ARG APP_NAME
ARG APP_PATH
ARG POETRY_VERSION
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONFAULTHANDLER=1
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
&& apt-get autoremove -y \
&& apt-get clean
RUN apt-get install npm -y \
&& apt-get autoremove -y \
&& apt-get clean
RUN npm install -g n && n lts
RUN npm install -g playwright
RUN playwright install chromium
ENV POETRY_HOME "/opt/poetry"
RUN python3 -m venv ${POETRY_HOME}
RUN ${POETRY_HOME}/bin/pip install "poetry==$POETRY_VERSION"
RUN ${POETRY_HOME}/bin/poetry --version
WORKDIR $APP_PATH
COPY ./poetry.lock ./pyproject.toml ./
COPY ./src ./src
FROM base AS shell
ARG APP_NAME
ARG APP_PATH
WORKDIR $APP_PATH
RUN ${POETRY_HOME}/bin/poetry install --no-root
COPY . $APP_PATH
RUN ${POETRY_HOME}/bin/poetry install
ENV PATH="${POETRY_HOME}/bin:$PATH"
CMD ["bash"]
uninstalling and reinstalling chromium inside the docker:
root@d35e4a1c53b1:/opt/app# playwright uninstall
Removing unused browser at /root/.cache/ms-playwright/chromium-1148
Removing unused browser at /root/.cache/ms-playwright/chromium_headless_shell-1148
Removing unused browser at /root/.cache/ms-playwright/ffmpeg-1010
root@d35e4a1c53b1:/opt/app# playwright install chromium
Downloading Chromium 131.0.6778.33 (playwright build v1148) from https://playwright.azureedge.net/builds/chromium/1148/chromium-linux-arm64.zip
165.1 MiB [====================] 100% 0.0s
Chromium 131.0.6778.33 (playwright build v1148) downloaded to /root/.cache/ms-playwright/chromium-1148
Downloading FFMPEG playwright build v1010 from https://playwright.azureedge.net/builds/ffmpeg/1010/ffmpeg-linux-arm64.zip
1.6 MiB [====================] 100% 0.0s
FFMPEG playwright build v1010 downloaded to /root/.cache/ms-playwright/ffmpeg-1010
Downloading Chromium Headless Shell 131.0.6778.33 (playwright build v1148) from https://playwright.azureedge.net/builds/chromium/1148/chromium-headless-shell-linux-arm64.zip
103 MiB [====================] 100% 0.0s
Chromium Headless Shell 131.0.6778.33 (playwright build v1148) downloaded to /root/.cache/ms-playwright/chromium_headless_shell-1148
OK, I found a temporary solution by fixing the version in the Dockerfile:
RUN npm install -g playwright@1.48.2
@AngeloChecked Thank you for details.
It seems like your playwright install
and playwright uninstall
commands are correctly installing chromium-1148 build which corresponds to playwright v1.49. This playwright is probably installed through npm install -g playwright
line.
However, when you run your python script that uses playwright, it needs a different chromium-1140 build which corresponds to playwright v1.48. This playwright is probably installed because of playwright = "^1.48.0"
requirement. I'd recommend to reconcile to a single playwright version, that should fix the problem.
@dgozman thank you!
I'll stick with this version for now while waiting for the next release: https://github.com/microsoft/playwright-python/releases
It seems like the issue has been resolved. If you still encounter problems, please file a new issue by filling in the "Bug Report" template and link to this one.
Hi playwright guys,
This error occur with this release:
BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1140/chrome-linux/chrome
Do you have any insights on this issue? Would you need additional information to assist with troubleshooting?