snok / install-poetry

Github action for installing and configuring Poetry
MIT License
587 stars 53 forks source link

Installation of poetry with python 3.9 is failing on latest github runner image #104

Closed tmbo closed 2 years ago

tmbo commented 2 years ago

Our builds started failing after a github runner image update.

On the github runner image Version: 20221018.2 the installation with snok/install-poetry leads to a non function poetry install. The install step does not fail, but poetry is not usable afterwards. Release notes of the github runner update: https://github.com/actions/runner-images/releases/tag/ubuntu20%2F20221018.2

The exact same workflow works with the github runner image version Version: 20221002.2 without issues.

The logs show, that there seems to be an issue within the snok/install-poetry step:

2022-10-24T07:46:33.6244875Z /home/runner/work/_actions/snok/install-poetry/2bf112a0f6979928eb6b011f39700db589c5961e/main.sh: /home/runner/.local//bin/poetry: /home/runner/.local/venv/bin/python: bad interpreter: No such file or directory

You can see the /home/runner/.local/venv/bin/python: bad interpreter: No such file or directory error in the logs. I am not exactly sure what the issue is but it sounds like the python path is off.

The only difference it the github runner image used, apparently github updated the image in between builds which led the builds to fail. I've attached the logs starting at the checkout step.

Used workflow steps:

jobs:
  test:
    name: Run Tests 
    runs-on: ubuntu-latest

    steps:
    - name: Checkout git repository 🕝
      uses: actions/checkout@v3
    - name: Set up Python 3.9 🐍
      uses: actions/setup-python@0ebf233433c08fb9061af664d501c3f3ff0e9e20  # v3.0
      with:
        python-version: '3.9'

    - name: Cache poetry install
      uses: actions/cache@v2
      with:          
        path: ~/.local
        key: poetry-1.1.13-0

    - uses: snok/install-poetry@2bf112a0f6979928eb6b011f39700db589c5961e
      with:
        version: 1.1.13
        virtualenvs-create: true
        virtualenvs-in-project: true

    - name: Cache python dependencies
      id: cache-deps
      uses: actions/cache@v2
      with:
        path: services/analytics/.venv
        key: pydeps-${{ hashFiles('**/poetry.lock') }}

    - name: Install Dependencies & Project📦
      run: |
        poetry run python -m pip install -U pip

Failing Log:

2022-10-24T07:46:32.1377942Z ##[group]Run actions/setup-python@0ebf233433c08fb9061af664d501c3f3ff0e9e20
2022-10-24T07:46:32.1378415Z with:
2022-10-24T07:46:32.1378707Z   python-version: 3.9
2022-10-24T07:46:32.1379199Z   token: ***
2022-10-24T07:46:32.1379414Z env:
2022-10-24T07:46:32.1379714Z   DEFAULT_PYTHON_VERSION: 3.9
2022-10-24T07:46:32.1380076Z   POETRY_VERSION: 1.1.13
2022-10-24T07:46:32.1380315Z ##[endgroup]
2022-10-24T07:46:32.2926708Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-24T07:46:32.2937466Z Successfully setup CPython (3.9.15)
2022-10-24T07:46:32.3028666Z ##[group]Run actions/cache@v2
2022-10-24T07:46:32.3028983Z with:
2022-10-24T07:46:32.3029288Z   path: ~/.local
2022-10-24T07:46:32.3029535Z   key: poetry-1.1.13-0
2022-10-24T07:46:32.3029935Z env:
2022-10-24T07:46:32.3030214Z   DEFAULT_PYTHON_VERSION: 3.9
2022-10-24T07:46:32.3030477Z   POETRY_VERSION: 1.1.13
2022-10-24T07:46:32.3030863Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.15/x64
2022-10-24T07:46:32.3031261Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.15/x64/lib
2022-10-24T07:46:32.3031607Z ##[endgroup]
2022-10-24T07:46:32.5399973Z ##[warning]The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-24T07:46:33.1003531Z Received 23841880 of 23841880 (100.0%), 65.0 MBs/sec
2022-10-24T07:46:33.1008989Z Cache Size: ~23 MB (23841880 B)
2022-10-24T07:46:33.1034455Z [command]/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/b269c137-bd98-405d-9354-9475dc78ee25/cache.tzst -P -C /home/runner/work/rasa-pro-services/rasa-pro-services
2022-10-24T07:46:33.3733626Z Cache restored successfully
2022-10-24T07:46:33.3780136Z ##[warning]The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-24T07:46:33.3810534Z 
2022-10-24T07:46:33.3814989Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-24T07:46:33.3818615Z Cache restored from key: poetry-1.1.13-0
2022-10-24T07:46:33.4012950Z ##[group]Run snok/install-poetry@2bf112a0f6979928eb6b011f39700db589c5961e
2022-10-24T07:46:33.4013252Z with:
2022-10-24T07:46:33.4013459Z   version: 1.1.13
2022-10-24T07:46:33.4013694Z   virtualenvs-create: true
2022-10-24T07:46:33.4013961Z   virtualenvs-in-project: true
2022-10-24T07:46:33.4014265Z   virtualenvs-path: {cache-dir}/virtualenvs
2022-10-24T07:46:33.4014534Z   installer-parallel: true
2022-10-24T07:46:33.4014759Z env:
2022-10-24T07:46:33.4014979Z   DEFAULT_PYTHON_VERSION: 3.9
2022-10-24T07:46:33.4015223Z   POETRY_VERSION: 1.1.13
2022-10-24T07:46:33.4015524Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.15/x64
2022-10-24T07:46:33.4015851Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.15/x64/lib
2022-10-24T07:46:33.4016122Z ##[endgroup]
2022-10-24T07:46:33.4263184Z ##[group]Run $GITHUB_ACTION_PATH/main.sh
2022-10-24T07:46:33.4263543Z $GITHUB_ACTION_PATH/main.sh
2022-10-24T07:46:33.4318390Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-10-24T07:46:33.4318727Z env:
2022-10-24T07:46:33.4318952Z   DEFAULT_PYTHON_VERSION: 3.9
2022-10-24T07:46:33.4319439Z   POETRY_VERSION: 1.1.13
2022-10-24T07:46:33.4319741Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.15/x64
2022-10-24T07:46:33.4320084Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.15/x64/lib
2022-10-24T07:46:33.4320349Z   VERSION: 1.1.13
2022-10-24T07:46:33.4320573Z   VIRTUALENVS_CREATE: true
2022-10-24T07:46:33.4320822Z   VIRTUALENVS_IN_PROJECT: true
2022-10-24T07:46:33.4321095Z   VIRTUALENVS_PATH: {cache-dir}/virtualenvs
2022-10-24T07:46:33.4321362Z   INSTALLER_PARALLEL: true
2022-10-24T07:46:33.4321605Z   INSTALLATION_ARGUMENTS: 
2022-10-24T07:46:33.4321826Z ##[endgroup]
2022-10-24T07:46:33.4769977Z 
2022-10-24T07:46:33.4771140Z Setting Poetry installation path as /home/runner/.local/
2022-10-24T07:46:33.4771593Z 
2022-10-24T07:46:33.4772152Z Installing Poetry 👷
2022-10-24T07:46:33.4773198Z 
2022-10-24T07:46:33.6129957Z Retrieving Poetry metadata
2022-10-24T07:46:33.6130606Z 
2022-10-24T07:46:33.6131484Z The latest version (1.1.13) is already installed.
2022-10-24T07:46:33.6229634Z /home/runner/work/_actions/snok/install-poetry/2bf112a0f6979928eb6b011f39700db589c5961e/main.sh: /home/runner/.local//bin/poetry: /home/runner/.local/venv/bin/python: bad interpreter: No such file or directory
2022-10-24T07:46:33.6237560Z /home/runner/work/_actions/snok/install-poetry/2bf112a0f6979928eb6b011f39700db589c5961e/main.sh: /home/runner/.local//bin/poetry: /home/runner/.local/venv/bin/python: bad interpreter: No such file or directory
2022-10-24T07:46:33.6244875Z /home/runner/work/_actions/snok/install-poetry/2bf112a0f6979928eb6b011f39700db589c5961e/main.sh: /home/runner/.local//bin/poetry: /home/runner/.local/venv/bin/python: bad interpreter: No such file or directory
2022-10-24T07:46:33.6253202Z /home/runner/work/_actions/snok/install-poetry/2bf112a0f6979928eb6b011f39700db589c5961e/main.sh: /home/runner/.local//bin/poetry: /home/runner/.local/venv/bin/python: bad interpreter: No such file or directory
2022-10-24T07:46:33.6274989Z 
2022-10-24T07:46:33.6275904Z Installation completed. Configuring settings 🛠
2022-10-24T07:46:33.6276394Z 
2022-10-24T07:46:33.6276727Z Done ✅
2022-10-24T07:46:33.6303177Z 
2022-10-24T07:46:33.6304312Z If you are creating a venv in your project, you can activate it by running 'source .venv/bin/activate'. If you're running this in an OS matrix, you can use 'source $VENV' instead, as an OS agnostic option
2022-10-24T07:46:33.7518861Z ##[group]Run actions/cache@v2
2022-10-24T07:46:33.7519286Z with:
2022-10-24T07:46:33.7519500Z   path: services/analytics/.venv
2022-10-24T07:46:33.7519855Z   key: pydeps-9643f14b2d02941c37c631e0a382015bfc07be8867d51ba5a34a1c6dee70fd3d
2022-10-24T07:46:33.7520169Z env:
2022-10-24T07:46:33.7520384Z   DEFAULT_PYTHON_VERSION: 3.9
2022-10-24T07:46:33.7520636Z   POETRY_VERSION: 1.1.13
2022-10-24T07:46:33.7520919Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.15/x64
2022-10-24T07:46:33.7521262Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.15/x64/lib
2022-10-24T07:46:33.7521549Z   VENV: .venv/bin/activate
2022-10-24T07:46:33.7521777Z ##[endgroup]
2022-10-24T07:46:33.8888514Z ##[warning]The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-24T07:46:33.9979197Z Cache not found for input keys: pydeps-9643f14b2d02941c37c631e0a382015bfc07be8867d51ba5a34a1c6dee70fd3d
2022-10-24T07:46:34.0118801Z ##[group]Run make install
2022-10-24T07:46:34.0119386Z make install
2022-10-24T07:46:34.0169605Z shell: /usr/bin/bash -e {0}
2022-10-24T07:46:34.0169823Z env:
2022-10-24T07:46:34.0170050Z   DEFAULT_PYTHON_VERSION: 3.9
2022-10-24T07:46:34.0170298Z   POETRY_VERSION: 1.1.13
2022-10-24T07:46:34.0170599Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.15/x64
2022-10-24T07:46:34.0170947Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.15/x64/lib
2022-10-24T07:46:34.0171233Z   VENV: .venv/bin/activate
2022-10-24T07:46:34.0171442Z ##[endgroup]
2022-10-24T07:46:34.0275316Z poetry run python -m pip install -U pip
2022-10-24T07:46:34.0283154Z make: poetry: Command not found
sondrelg commented 2 years ago

The workflow seems to run fine here: https://github.com/sondrelg/issue-104/actions/runs/3315315838/jobs/5475752366 :thinking: Did I set it up wrong somehow?

tmbo commented 2 years ago

Thanks a lot for jumping on this. I found the issue: the poetry installation is cached and for some reason it cached a broken installation - I am not sure why there was an installation broken, but in any case - this is the reason why it didn't work.

I'll close this one as the issue isn't your (great!) installer.

sondrelg commented 2 years ago

I think I might know why actually. It used to break for me every time a new Python patch version came out. If you include -${{ steps.setup-python.outputs.python-version }} in your cache key it should clear the cache automatically in these cases :+1:

tmbo commented 2 years ago

ah thanks that is helpful :+1: