[Python] Playwright install fails on Ubuntu 24.04 due to missing system dependencies, even...

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to set up Playwright for Python on Ubuntu 24.04 (Noble Numbat).

    Here are the steps I followed:


    • Created a virtual environment:

      python3 -m venv venv
      source venv/bin/activate

    • Installed Playwright and other dependencies:

      pip install playwright rich python-dotenv

    • Then tried to install the browsers:

      playwright install

    But I received this warning:

    ```
    Playwright Host validation warning:
    Host system is missing dependencies to run browsers.
    Please install them with the following command:
    sudo playwright install-deps
    ```


    • However, since Playwright is installed inside a venv, I can't run sudo playwright install-deps (it says command not found).


    • I manually tried installing the recommended system packages:

      sudo apt-get install -y libnss3 libatk-bridge2.0-0 libxss1 libasound2 libgbm1 libgtk-3-0 libxshmfence-dev libxrandr2 libxcomposite1 libxcursor1 libxdamage1 libxi6

    • Some packages like libasound2 and libevent-2.1-7t64 either don't exist or have been renamed in Ubuntu 24.04 (e.g., libasound2t64 instead of libasound2).


    • Even after manually installing what I could, running playwright install still gives the same missing dependencies error.
    Problem Summary:

    • playwright install fails because system libraries expected by Playwright are not available or have changed names in Ubuntu 24.04.
    • Manually installing libraries does not fully solve the issue.
    • I just want to use Playwright for simple browser automation scripts (not using it for testing or running Pytest).
    What I'm asking:


    ✅ Is there a clean, stable way to set up Playwright on Ubuntu 24.04 without dependency issues?
    ✅ Is using Docker with the official Playwright image the recommended solution here?
    ✅ Or is there a native way to fix it without switching to Docker?

    I'm looking for a stable, simple, and maintainable solution to run Playwright automation scripts.

    Thanks in advance for any help!

    Continue reading...

Compartilhe esta Página