diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f61c2abc2a576ba024747a5813cbdf40315ac675..18ecfd2c9463eaaff0ab50ed614b7b592e05bbef 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,23 +6,27 @@ stages:
     - pypi_upload
 
 before_script:
+    - pyenv local $(latest_python 3.7)
     - pip install -U pip setuptools
     - pip install tox
 
 tests:
     script:
+        - pyenv local $(latest_python 3.7)
         - tox -r -vv -e py37
     stage: tests
     allow_failure: true
 
 style:
     script:
+        - pyenv local $(latest_python 3.7)
         - tox -r -vv -e flake8
     allow_failure: true
     stage: style
 
 pypi_test:
     script:
+        - pyenv local $(latest_python 3.7)
         - python setup.py sdist
         - twine upload -u openbis-team -p 4z2-3oZ-rFK-YNh --repository-url https://test.pypi.org/legacy/ dist/*
     when: manual