Cannot connect to `pypi.org` in CI

Hello,

I am trying use Gitlab CI but I encounter a problem when trying to install my environment with pip: it seems that the server executing the script cannot connect to pypi.org.

content of .gitlab-ci.yml:

test-carotid:
  image: python:latest
  before_script:
    - pip install -e ./src
  script:
    - pytest ./src/tests

traceback:

Preparing metadata (setup.py): finished with status 'done'
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f2d4cfd27a0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/monai/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f2d4c44b640>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/monai/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f2d4c44b490>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/monai/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f2d4c44b310>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/monai/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f2d4c44b190>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/monai/
ERROR: Could not find a version that satisfies the requirement monai==0.8.1 (from carotid) (from versions: none)
ERROR: No matching distribution found for monai==0.8.1
ERROR: Job failed: command terminated with exit code 1

Requirements of my projects:

monai==0.8.1
scipy==1.7.3
matplotlib==3.5.2
simpleitk==2.1.1
numpy==1.22.4
scikit-learn==1.1.1
tqdm==4.64.0
pandas==1.4.2
pydicom==2.3.0
click==8.1.3
torch
pytest

Does someone know how to enable this connection?

Hi @14thibea

Is this using your own runner, or one provided by GitLab?

Hello @snim2

Here is the information about my job:

Duration: 6 minutes 41 seconds

Finished: 1 day ago

Timeout: 1h (from project)

Runner: #185 (8EL4fHtD) gitlab-ci-runner-0

I don’t know how it is possible to change the runner, so I guess that I am using the one provided by GitLab.

You can set the runner by going to Settings → CI/CD from your project page. You can either use runners on your own servers, or the “shared” runners that GitLab provides. I would expect the shared runners to be able to connect to common package registries though!

Does your call to pip work correctly locally?