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 - [X]
v2 - [ ] Some other tag (such as
v2.0.1ormaster)
Environment
- [X] self-hosted
- [X] 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:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- 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

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
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
Found these related issues: #89 and #92
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.
I was able to figure out a workaround that seems ok. Not fully tested yet for possible side effects.
If I modify the setup script to create a symlink from /opt/hostedtoolcache to the directory it expects for RUNNER_TOOL_CACHE, everything installs correctly. So my modified script is now:
#!/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
# Make /actions-runner/_work
mkdir _work
# Link /opt/hostedtoolcache as /actions-runner/_work/_tool
ln -s /opt/hostedtoolcache _work/_tool
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
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
@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"
Any chance this issue get attention?
Still not dead, and still wanting this issue to get attention. Someone alive?
poke
another poke in the wall...
+1, following on this
@kldavis4 How did your workaround end up long term? Still working well?
...PPoke
+1
+1
+1
@kldavis4 I tried your workaround on amazon linux 2 but still no luck.
action
# pre-commit setup
- uses: actions/setup-python@v2
with:
python-version: 3.9.5
env:
AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache
RUNNER_TOOL_CACHE: /opt/hostedtoolcache
userdata
export USER=root
export RUNNER_ALLOW_RUNASROOT=true
export RUNNER_TOOL_CACHE=/opt/hostedtoolcache
export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
mkdir -p $AGENT_TOOLSDIRECTORY
mkdir -p /actions-runner/_work
ln -s $AGENT_TOOLSDIRECTORY /actions-runner/_work/_tool
curl -s https://raw.githubusercontent.com/actions/runner/v2.278.0/scripts/create-latest-svc.sh | bash -s myorg
check
# ls -la /actions-runner/_work/
total 0
drwxr-xr-x 2 root root 19 Jun 21 20:45 .
drwxr-xr-x 3 root root 19 Jun 21 20:45 ..
lrwxrwxrwx 1 root root 20 Jun 21 20:45 _tool -> /opt/hostedtoolcache
In the action, I see
Error: Version 3.9.5 with arch x64 not found
If I look in the manifest, I see it
{
"filename": "python-3.9.5-linux-16.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "16.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.9.5-109482/python-3.9.5-linux-16.04-x64.tar.gz"
},
It looks like @actions/tool-cache may be the culprit.
https://github.com/actions/setup-python/blob/dc73133d4da04e56a135ae2246682783cc7c7cb6/src/find-python.ts#L10
We're using the default or some non pypy one so it's hitting useCpythonVersion
https://github.com/actions/setup-python/blob/dc73133d4da04e56a135ae2246682783cc7c7cb6/src/find-python.ts#L194-L201
which calls tc.find which fails to find it so it throws the error.
https://github.com/actions/setup-python/blob/dc73133d4da04e56a135ae2246682783cc7c7cb6/src/find-python.ts#L86-L115
@kldavis4 How did your workaround end up long term? Still working well?
@cep21 yes. we still have the workaround in place and haven't run into any issues so far
@nitrocode couple things to check out...
- I am not specifying any environment variables (AGENT_TOOLSDIRECTORY & RUNNER_TOOL_CACHE). I don't think that should cause a problem but it is different than our current workflows.
- I'm not totally sure on what directory the userdata runs in. My userdata creates the actions-runner folder in the "current" directory and I'm not confident that it will be the filesystem root directory and not the root user's home
- what version of ubuntu is your AMI? I'm using
ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64*
@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.