diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 35578a61156b4a3e903cb8296216778b78961746..594bc6a6fcb03b0d437f0b465c70a719e39c30b7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -65,6 +65,7 @@ wheel_packaging:
         echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
       fi
     - apk add --update make bash docker-compose python3 py3-pip
+    - python3 -m venv venv && source venv/bin/activate
     - pip install shyaml
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - touch ~/.Xauthority
@@ -286,6 +287,7 @@ unit_test:
     - apk add --update bind-tools
     - apk add --update postgresql14-client gzip socat
     - apk add --update python3 py3-pip
+    - python3 -m venv venv && source venv/bin/activate
     - pip install shyaml
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - touch /root/.Xauthority
@@ -351,6 +353,7 @@ publish_on_gitlab:
   before_script:
     - python3 --version
     - pip --version
+    - python3 -m venv venv && source venv/bin/activate
     - pip install twine --upgrade
   script:
     - echo "run twine for gitlab"