Use wheels in gitlab-ci to avoid long compilations

1.1k views Asked by At

In my gitlab-ci.yml I test some code using pandas scikit and scipy. Most of the time in the build/pipeline is spend compiling numpy, scipy, ...

Can I create a wheel and using ADD to just copy and pip install an already made wheel ?

I requet for a recent version of pip::

$ cat requirements/base.txt
pip>=8.1.2
setuptools>=20.7.0
wheel>=0.29
numpy
scipy
scikit-learn

Here my .gitlab-ci and effectivly spend each time a lot :

$ cat .gitlab-ci

image : python:2

test:
  script:
  - apt-get update -qy
  - apt-get install -y python-dev python-pip python-virtualenv
  - pip install -r requirements/base.txt
  - ...

Trying to answer to the @ev-br here the gitlab-ci pipeline output, you can see that pandas is not take as a wheel but pandas-0.19.1.tar.gz.:

$ pip install -r requirements.txt --cache-dir=/cache
Requirement already satisfied: pip>=9 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: setuptools>=26 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 2))
Collecting wheel>=0.29 (from -r requirements.txt (line 3))
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Collecting setuptools_scm (from -r requirements.txt (line 4))
  Using cached setuptools_scm-1.15.0-py2.py3-none-any.whl
Collecting setuptools_scm_git_archive (from -r requirements.txt (line 5))
  Using cached setuptools_scm_git_archive-1.0-py2.py3-none-any.whl
Collecting pandas==0.19.1 (from -r requirements.txt (line 6))
  Downloading pandas-0.19.1.tar.gz (8.4MB)
Collecting python-dateutil>=2 (from pandas==0.19.1->-r requirements.txt (line 6))
  Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
1

There are 1 answers

1
ev-br On

If your pip in recent enough (version 8 or higher IIRC),you might be able to just use the manulinux wheels automatically by pip installing numpy and scipy. Try pip install --upgrade pip or similar on the CI.