From f3b285f49a388246f059e3e16f70b789fa36dbb6 Mon Sep 17 00:00:00 2001 From: "Martin Haase (FDTech GmbH)" Date: Wed, 21 Oct 2026 11:52:04 +0200 Subject: [PATCH] github: install python tools into a virtualenv Installing packages into the system interpreter with "python -m pip install" fails on runner images that enforce PEP 668: error: externally-managed-environment This is the case for Gitea Actions with the default gitea/runner-images:ubuntu-latest image (Ubuntu 24.04, Python 3.12). GitHub hosted runners still work because they ship a separately installed Python that is not marked as externally managed. Create a virtualenv in $RUNNER_TEMP instead and put it into $GITHUB_PATH so that the following steps find the installed tools. This works the same on GitHub and Gitea and does not rely on the Python setup of the runner image. --- .github/workflows/pre-commit.yaml | 5 ++++- .github/workflows/recipes_test.yaml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index acdd7e8d..03769dc7 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -9,7 +9,10 @@ jobs: uses: actions/checkout@v4 - name: Setup pre-commit - run: python -m pip install pre-commit + run: | + python3 -m venv "$RUNNER_TEMP/venv" + echo "$RUNNER_TEMP/venv/bin" >> "$GITHUB_PATH" + "$RUNNER_TEMP/venv/bin/pip" install pre-commit - name: Cache pre-commit state uses: actions/cache@v4 diff --git a/.github/workflows/recipes_test.yaml b/.github/workflows/recipes_test.yaml index 64a59e74..146e09eb 100644 --- a/.github/workflows/recipes_test.yaml +++ b/.github/workflows/recipes_test.yaml @@ -9,7 +9,10 @@ jobs: uses: actions/checkout@v4 - name: Setup Bob - run: python -m pip install BobBuildTool + run: | + python3 -m venv "$RUNNER_TEMP/venv" + echo "$RUNNER_TEMP/venv/bin" >> "$GITHUB_PATH" + "$RUNNER_TEMP/venv/bin/pip" install BobBuildTool - name: Fetch layers run: bob -C tests/buildall layers update