question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.
...

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vsafonkincommented, Oct 12, 2022

@blgnksy, ok, closed. Feel free to reopen it.

0reactions
blgnksycommented, Oct 12, 2022

Hi, I implemented my own solution and am currently not using actions/setup-python. I could try using it for a new project in the future. Thank you for your consideration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Github actions: Dependencies lock file is not found in runners ...
In my GitHub actions I wanted to run npm test on the nested project/dir so I had to specify to use my package.json...
Read more >
Linker Tools Error LNK1104 - Microsoft Learn
To fix a path issue for command-line builds, verify the LIB environment variable is set. Make sure it includes paths for all the...
Read more >
Files exists but can't be used to build artifacts. (#15530) - GitLab
I want to create build artifacts, but Gitlab CI keeps telling me no matching files, although I explicitly check if the files exists....
Read more >
Common Build Problems - Travis CI Docs
Check the list of dependencies in the build log, usually output including versions and see, if there's anything that's changed. Sometimes, this can...
Read more >
Common Problems | TeamCity On-Premises Documentation
If the build succeeds from the console but still fails in TeamCity, use a command line runner in TeamCity to launch the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found