Search code examples
pythongithubpipgithub-actionsversion

Github workflow for pip fails because Python version is not found


My Github workflow fails to install Python 3.8.2 and shows the following error:

Run actions/setup-python@v3
  with:
    python-version: 3.8.2
    token: ***
Version 3.8.2 was not found in the local cache
Error: Version 3.8.2 with arch x64 not found
The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json

If it helps, relevant parts of my workflow file is as follows:

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.8.2"]

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}

What am I missing? And how can I fix the error?

I tried checking the URL in the error, however it shows that there are versions existing with the x64 architecture for darwin, linux and win32. So, I don't know if I am misunderstanding the error.


Solution

  • The problem arose because ubuntu-latest is dynamic. Currently, ubuntu-latest points to 22.04. At least that's what I understand from this link. From the cache, I see that Python v3.8.2 is supported for ubuntu 20.04 (at the latest) and not for 22.04, which was causing the fail.

    Therefore, fixing the ubuntu version should help. Changing the line

        runs-on: ubuntu-latest
    

    in the workflow file to

        runs-on: ubuntu-20.04
    

    worked! Python could be used from the cache and subsequent jobs ran.

    Thanks to PforPython's answer for getting me to think in the right direction.