Skip to content

Fails while building dependencies, since the runner can't find the include path #507

@blgnksy

Description

@blgnksy

Description:
I have a workflow that builds and test my Python project. In poetry installation steps gcc can't find the Python header/s and the build fails. When I checked the /opt/hostedtoolcache/Python/3.8.13/x64/include/python3.8, there is no such directory.

Action version:
4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
3.7.13
3.8.13

Repro steps:

jobs:
  test:
    runs-on: [self-hosted, xxxx]
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.7, 3.8]
    name: flake8 and pytest on Python ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
          fetch-depth: 0

      - name: Set up Python ${{ matrix.python-version }}
        id: setup-python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}-dev # also tried without dev 
          update-environment: true # also tried without this line.

      - name: Setup Poetry
        run: |
          curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.14 python${{ matrix.python-version }}

      - name: Load cached poetry packages
        id: cached-poetry-dependencies
        uses: actions/cache@v2
        with:
          path: .venv
          key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

      - name: Poetry install python packages
        run: |
          CPATH=$pythonLocation/include/python${{ matrix.python-version }}m
          echo "CPATH=$CPATH" >> $GITHUB_ENV
          poetry env use ${{ matrix.python-version }}
          poetry install --no-interaction
        if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

Expected behavior:
Installed dependencies.

Actual behavior:
Error:

CPATH=$pythonLocation/include/python3.7
  echo "CPATH=$CPATH" >> $GITHUB_ENV
  poetry install --no-interaction --no-dev
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /home/***/actions-runner/_work/_tool/Python/3.7.13/x64
    PKG_CONFIG_PATH: /home/***/actions-runner/_work/_tool/Python/3.7.13/x64/lib/pkgconfig
    Python_ROOT_DIR: /home/***/actions-runner/_work/_tool/Python/3.7.13/x64
    Python2_ROOT_DIR: /home/***/actions-runner/_work/_tool/Python/3.7.13/x64
    Python3_ROOT_DIR: /home/***/actions-runner/_work/_tool/Python/3.7.13/x64
    LD_LIBRARY_PATH: /home/***/actions-runner/_work/_tool/Python/3.7.13/x64/lib 
...
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/pip-build-env-7iw6i3c7/overlay/lib/python3.8/site-packages/numpy/core/include -I./common -I/home/***/actions-runner/_work/datapipeline/datapipeline/.venv/include -I/opt/hostedtoolcache/Python/3.8.13/x64/include/python3.8 -c ./common/maskApi.c -o build/temp.linux-x86_64-cpython-38/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
pycocotools/_mask.c:6:10: fatal error: Python.h: No such file or directory
         #include "Python.h"
                        ^~~~~~~~~~
        compilation terminated.
...

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions