Version
mcr.microsoft.com/playwright/python:v1.50.0-noble
Steps to reproduce
- Start the container in interactive mode with the provided run command:
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'
- 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 )
Environment
- Operating System: [Ubuntu 22.04]
- CPU: [intel]
- Browser: [All, Chromium, Firefox, WebKit]
- Python Version: [3.12]
- Other info:
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