diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4545f9a92afc0e330487a081fc22c3cd1628ab98..2bf8cef1e5eecef13b22bf776f30fc1c7918014a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,6 +21,7 @@ build-env:
   - cd build/
   - poetry config virtualenvs.in-project true
   - poetry install --no-root
+  - poetry run pip install poetry
   artifacts:
     paths:
       - $POETRY_CACHE_DIR/virtualenvs/
@@ -31,6 +32,7 @@ format:
     - export VIRTUALENV_NAME=$(ls $POETRY_CACHE_DIR/virtualenvs)
     - echo $VIRTUALENV_NAME
     - source $POETRY_CACHE_DIR/virtualenvs/$VIRTUALENV_NAME/bin/activate
+    - which poetry  # Check if poetry is in the PATH
     - poetry run pre-commit install
     - poetry run yapf -i -r -p .
     - poetry run ruff .