setup-python: Error: Version X with arch x64 not found

Describe the bug I am attempting to use setup-python with a self-hosted runner running on an ec2 instance. I am using this ami ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20201112. I have followed the instructions here. I am getting the following output when the setup-python action is run:

Run actions/setup-python@v2
  with:
    python-version: 3.7.7
    token: ***
  env:
    AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache
Version 3.7.7 was not found in the local cache
Version 3.7.7 is available for downloading
Download from "https://github.com/actions/python-versions/releases/download/3.7.7-20200609.4/python-3.7.7-linux-18.04-x64.tar.gz"
Extract downloaded archive
/bin/tar xz --warning=no-unknown-keyword -C /actions-runner/_work/_temp/f7f341f3-b2b9-4eff-bff0-5b55acb3a0f1 -f /actions-runner/_work/_temp/402c2129-71c1-46e4-9263-3b04a4b9772a
Execute installation script
Check if Python hostedtoolcache folder exist...
Create Python 3.7.7 folder
Copy Python binaries to hostedtoolcache folder
Create additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)
Upgrading PIP...
Looking in links: /tmp/tmpryj40n3d
Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages (41.2.0)
Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages (19.2.3)
Collecting pip
Using cached https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-20.2.4
Create complete file
Error: Version 3.7.7 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

It’s unclear what is actually failing as it seems to be finding the 3.7.7 python version and installs it and then it fails after installing pip.

Which version of the action are you using?

  • v1
  • v2
  • Some other tag (such as v2.0.1 or master)

Environment

  • self-hosted
  • Linux
  • Windows
  • Mac

If applicable, please specify if you’re using a container

Python Versions Please list all of the effected versions of Python (3.8.2, etc.) Tried 3.7.7, 3.10.0-alpha.2

To Reproduce Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Run/Repo Url If applicable, and if your repo/run is public, please include a URL so it is easier for us to investigate. NA

Screenshots Screen Shot 2020-11-13 at 5 00 32 PM

Additional context Here’s the script that launches the runner:

#!/bin/bash -xe
apt-get update -y
apt-get upgrade -y
${local.apt-get-all-packages}
sudo usermod -a -G docker ubuntu
sudo systemctl start docker
sudo systemctl enable docker
export RUNNER_ALLOW_RUNASROOT=true
export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
mkdir actions-runner
mkdir /opt/hostedtoolcache
cd actions-runner
curl -O -L https://github.com/actions/runner/releases/download/v${var.runner-version}/actions-runner-linux-x64-${var.runner-version}.tar.gz
tar xzf ./actions-runner-linux-x64-${var.runner-version}.tar.gz
./config.sh --url https://github.com/${var.owner}/${var.repository} --token ${var.github-registration-token} --name "actions-runner-$(hostname)" --unattended
sudo ./svc.sh install
sudo ./svc.sh start

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 50
  • Comments: 72 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Any chance this issue get attention?

For me the same. I use https://github.com/nektos/act for testing Github actions locally.

I got

[Deploy Powerlevel10k Docs/Python 3.x sample-2]   ❗  ::error::Version 3.x with arch x64 not found%0AThe list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
[Deploy Powerlevel10k Docs/Python 3.x sample-2]   ❌  Failure - Setup python
Error: exit with `FAILURE`: 1

and even tried the one from the README

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['2.x', '3.x']
    name: Python ${{ matrix.python-version }} sample
    steps:
      - uses: actions/checkout@v2
      - name: Setup python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
          architecture: x64
      - run: python my_script.py

Looks like the latest ubuntu version has some issue, sticking to 20.04 resolved this issue.

From:

runs-on: ubuntu-latest

To:

runs-on: ubuntu-20.04

Tried changing the actions/setup-python@v1 to actions/setup-python@v2? I just did and it worked for me somehow. In my case it was 3.9.9 arch 64 missing.

This issue does not seem to be resolved with local testing with act running on a MacOS M1 chip machine. The actions is set as follows:

      - name: Set up Python3.8
        uses: actions/setup-python@v3 # same error appears for v4 as well.
        with:
          python-version: 3.8 # same error appears for 3.7 3.9
          architecture: x64
          platform: linux

The command to reproduce the issue is

 act --container-architecture linux/arm64

Sorry to reopen but this is happening to me now with setup-python@v4. Tried a matrix with all python version >3.9 and they all had the same error. The manifest of python versions also shows the target versions with the same arch but is returning an error. Have tried the workarounds in this issue with no luck 😕

self-hosted linux x64

Here’s a screenshot: image

@kldavis4 I’m using Amazon Linux 2 AMI. That’s probably the issue. The platform_version in the manifest seems to be exclusive to Ubuntu with no way to override it.

Unrelated to the problem of the author, but I initially thought I had the same problem: I used debian instead of ubuntu, thus it did not work.

Mabye helpful for other stumbling over this

I’m not sure why this is closed. Indeed (based on the last few comments) it does not appear to be fixed.

As per https://github.com/actions/setup-python/issues/541#issuecomment-1314296872 it appears that (at least for me) the following workaround works:

  • set runner image version to ubuntu-20.04 instead of ubuntu-latest.

However it seems to me that to be considered “fixed” it should work with ubuntu-latest as well.

Am I missing something?

@dsame Please re-open, or please explain why this is considered resolved? Maybe I am missing something? Thank you.

@meiswjn You can use Debian with creating /etc/lsb-release like Ubuntu. If you use Debian 10, /etc/lsb-release should be same as Ubuntu 18.04 like this.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"

The root of this issue seems to be that the tool-cache library function for fetching the cache directory (https://github.com/actions/toolkit/blob/master/packages/tool-cache/src/tool-cache.ts#L693) is using RUNNER_TOOL_CACHE but this is set to /actions-runner/_work/_tool instead of /opt/hostedtoolcache. Setting RUNNER_TOOL_CACHE (within the self-hosted runner or the actions yml) seems to have no effect and I haven’t been able to determine yet how the default is getting set.

In my case I was doing something stupid. Maybe this will help someone.

- name: Set up Python
  uses: actions/setup-python@v4
  with:
    python-version: 3.10

3.10 is just a number in yaml and gets interpreted as version 3.1. Changed it to "3.10" and it worked (with ubuntu-latest).

Same too. Looks like latest was updated from 20.04.5 to 22.04.1.

another poke in the wall…

ubuntu-latest is a bad practice as you could have read on the thread,

Didn’t see someone mentioning it was bad practice. Perhaps I read past it, but at the end of the day I can see why. Thanks for mentioning this!

In addition the comment made by abarragan-adtriba was very helpful.

In my case, wanting Python 3.11.1, I should use ubuntu-22.04 instead. Again, thanks for pointing this out!

@abarragan-adtriba ubuntu-latest on GitHub Action

@fan9704 , your issue is already explained in the thread, in particular: https://github.com/actions/setup-python/issues/162#issuecomment-1344117224

I am having the same error on ubuntu

Description: I used workflow to auto test code, it was working fine 10 days ago, and now I am having this error:

Error: Version 3.10.0 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

Action version: 2-4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

‘3.6’, ‘3.7’, ‘3.8’, ‘3.9’, ‘3.10.0’ Repro steps:

name: Run tests

on:
  push:
    branches:
      - "main"
  pull_request:
    branches:
      - "main"

jobs:
  test:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        # Run in all these versions of Python
        python-version: ['3.6', '3.7', '3.8', '3.9', '3.10.0']

    steps:
        # Checkout the latest code from the repo
      - name: Checkout repo
        uses: actions/checkout@v2
        # Setup which version of Python to use
      - name: Set Up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2

        with:
          python-version: ${{ matrix.python-version }}
        # Display the Python version being used
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"
        # Install the package using the setup.py
      - name: Install package
        run: python setup.py install
        # Install pytest (you can use some other testing utility)
      - name: Install pytest, and requirements
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install pytest
        # Run the tests. I'm using pytest and the file is in the tests directory.
      - name: Run tests
        run: pytest tests/test*

I changed runs-on: ubuntu-latest to runs-on: macos-latest and it started working.

Sorry to reopen but this is happening to me now with setup-python@v4. Tried a matrix with all python version >3.9 and they all had the same error. The manifest of python versions also shows the target versions with the same arch but is returning an error. Have tried the workarounds in this issue with no luck 😕

self-hosted linux x64

Here’s a screenshot: image

Hi, @Yohlo 👋 ! I tried to reproduce your issue but on my self-hosted Ubuntu runner everything works as expected. May I ask you to create new issue with a broader explanation of your case? BTW, the latest stable version of the Python available now is 3.10. For unstable versions currently it’s 3.11.0-beta.3.

Hello @kldavis4 i am going to close this issue because it seems to be resolved and there’s no other comments so far. Feel free to open new issue or reopen this one in case of any problem

Hi, Any workaround for macOS?

MacOS has its tool-cache pre-built pythons and should work out of box. If it does not please check if you use @v3 of setup-python

hello @kldavis4 ,

Sorry for delayed reply, i’ve just noticed you set AGENT_TOOLSDIRECTORY on your host instead of setting with the pipeline:

      - name: Setup python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7.7
          architecture: x64
        env:
          AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache

It is known inconvenience of configuring the action on self-hosted agent and it expected to be eliminated very soon with https://github.com/actions/setup-python/pull/394. As soon as the PR will be merged your build should start working like a charm.

I’m also running in to this situation with Linode, not exclusive to AWS deployments. Ubuntu 21.04 and 20.10 don’t behave, using 20.04 LTS does seem to resolve it.

@bumbummen99 could you share that ? I’d be interested in using that in the interim if it’s easy enough to choose a specific python version to install.

It is pretty much using a cannon for a bird. You will have to install python to the OS on which you run the runner (what totally defies the purpose of this package: dynamically using any version).

Should be something like yum add pythonX.X

I am using philips-labs/terraform-aws-github-runner so i use the following terraform variable to apply it: https://github.com/philips-labs/terraform-aws-github-runner/blob/68635ddb9e1828d50a5e62ce6c8c5da589d501cd/variables.tf#L170

+1, following on this

poke

Still not dead, and still wanting this issue to get attention. Someone alive?