[Python] Install of opencv-python-headless takes a long time

Discussão em 'Python' iniciado por Stack, Fevereiro 24, 2025.

  1. Stack

    Stack Membro Participativo

    When I install opencv-python-headless in Google Colab, it takes 15 minutes to complete.

    My code:

    ! pip install --upgrade pip
    ! pip install opencv-python-headless


    Here's a notebook with this code which recreates the problem: https://colab.research.google.com/g.../slow-install-of-opencv-python-headless.ipynb.

    The process eventually completes, but I'd like to reduce the time to install.

    I saw from `Building wheel for opencv-python (PEP 517) ... -` runs forever a discussion about compiling OpenCV, which could very well be what is happening here. However, this same SO post states that if you upgrade pip, it will use pre-built wheels.

    Edit: Added @intsco's workaround to the Google Colab

    Continue reading...

Compartilhe esta Página