[Python] Is there any way to force pip install to retry on requirements install failure?

Discussão em 'Python' iniciado por Stack, Junho 8, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to install some pip requirements in a container I build. But due to my setup (docker build runs in a VM on a system connected over VPN to the network where the git server is located. COVID-19 situation) I get the error below. I know the issue is caused by my setup as sometimes works fine. Plus if i run the same docker build on a machine within the same network with the git server, also works fine. I spend some time to try to figure out my network problem, but haven't found any proper solution yet. So knowing that some time the pin install git clone works, i was wondering if there is any way of instructing pip to retry the installation o failed component, until it succeeds?

    This is how I call pip install:

    pip install --no-cache-dir --disable-pip-version-check -r requirements.txt


    The git lab repo URL is properly defined in the requirements.txt

    Thanks

    Collecting git+https://gitlab%2Bdeploy-token-98:****@git.my.host.com/core-tech/tools/nlu/trsx-converter.git@0.0.3 (from -r requirements.txt (line 19))
    Cloning https://gitlab%2Bdeploy-token-98:****@git.my.host.com/core-tech/tools/nlu/trsx-converter.git (to revision 0.0.3) to /tmp/pip-req-build-t8m2io14
    Running command git clone -q 'https://gitlab%2Bdeploy-token-98:****@git.my.host.com/core-tech/tools/nlu/trsx-converter.git' /tmp/pip-req-build-t8m2io14
    fatal: unable to access 'https://git.my.host.com/core-tech/tools/nlu/trsx-converter.git/': The requested URL returned error: 511
    ERROR: Command errored out with exit status 128: git clone -q 'https://gitlab%2Bdeploy-token-98:****@git.my.host.com/core-tech/tools/nlu/trsx-converter.git' /tmp/pip-req-build-t8m2io14 Check the logs for full command output.

    Continue reading...

Compartilhe esta Página