You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type "from playwright.sync_api import sync_playwright"
Python throws an error:
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'playwright'
Exit python
run 'pip install playwright'
retry step 3, the import works and playwright works with python.
Conclusion: The container does not allow Python to use playwright out of the box, it is missing the playwright-python component.
Expected behavior
"ok" - the import works and I can start issuing playwright-calls.
I expect the playwright/python container to contain the necessary components to at least use Playwright from within python.
As it stands it is a playwright-container which happens to have Python installed, but as a separate component with no connection to Playwright.
Actual behavior
Python throws an error:
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'playwright'
Exit python
run 'pip install playwright'
retry step 3, the import works and playwright works with python.
Additional context
I could be be all wrong. Perhaps I am using the playwright/python container in the wrong way.
But:
the instructions for playwright + python (not the docker version) state that you must run at least "pip install pytest-playwright"
the instructions for the playwright/python container state that you can pull the image and run
"from playwright.sync_api import sync_playwright" (it says so in https://playwright.dev/python/docs/docker )
In none of Playwright's Docker containers we install Playwright, we install only the browsers and system dependencies as per here. Since usually there are multiple package-managers in the ecosystem we don't want to assume which one you are using. This applies to Python and Node.js as well.
Would installing it work for you? We could also add another note that its required to have Playwright installed via e.g. pip.
Version
mcr.microsoft.com/playwright/python:v1.50.0-noble
Steps to reproduce
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v1.50.0-noble /bin/bash
start python: "python"
type "from playwright.sync_api import sync_playwright"
Python throws an error:
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'playwright'
Conclusion: The container does not allow Python to use playwright out of the box, it is missing the playwright-python component.
Expected behavior
"ok" - the import works and I can start issuing playwright-calls.
I expect the playwright/python container to contain the necessary components to at least use Playwright from within python.
As it stands it is a playwright-container which happens to have Python installed, but as a separate component with no connection to Playwright.
Actual behavior
Python throws an error:
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'playwright'
Additional context
I could be be all wrong. Perhaps I am using the playwright/python container in the wrong way.
But:
"from playwright.sync_api import sync_playwright" (it says so in https://playwright.dev/python/docs/docker )
Environment
The text was updated successfully, but these errors were encountered: