[GH-ISSUE #418] Python 3.9 installation fails with act but works on Github #290

Closed
opened 2026-03-01 21:42:06 +03:00 by kerem · 10 comments
Owner

Originally created by @tomasaschan on GitHub (Nov 12, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/418

Consider the following definition:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.9"

This works when running on Github, as can be seen in the log here (that build fails on a later, unrelated, step) but when running locally with act it fails to find the 3.9 version, and logs the following output:

λ act
[Build and Test/build] 🚀  Start image=node:12.6-buster-slim
[Build and Test/build]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Build and Test/build]   🐳  docker cp src=/home/taschan/code/github/tomasaschan/hiplog/. dst=/github/workspace
[Build and Test/build] ⭐  Run actions/checkout@v2
[Build and Test/build]   ✅  Success - actions/checkout@v2
[Build and Test/build] ⭐  Run Set up Python
[Build and Test/build]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v2
[Build and Test/build]   🐳  docker cp src=/home/taschan/.cache/act/actions-setup-python@v2 dst=/actions/
[Build and Test/build]   💬  ::debug::Semantic version spec of 3.9 is 3.9
[Build and Test/build]   💬  ::debug::isExplicit: 
[Build and Test/build]   💬  ::debug::explicit? false
[Build and Test/build]   💬  ::debug::evaluating 0 versions
[Build and Test/build]   💬  ::debug::match not found
| Version 3.9 was not found in the local cache
[Build and Test/build]   💬  ::debug::check 3.10.0-alpha.2 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.10.0-alpha.1 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.9.0 satisfies 3.9
[Build and Test/build]   💬  ::debug::x64===x64 && darwin===linux
[Build and Test/build]   💬  ::debug::x64===x64 && linux===linux
[Build and Test/build]   💬  ::debug::x64===x64 && linux===linux
[Build and Test/build]   💬  ::debug::x64===x64 && linux===linux
[Build and Test/build]   💬  ::debug::x64===x64 && win32===linux
[Build and Test/build]   💬  ::debug::x86===x64 && win32===linux
[Build and Test/build]   💬  ::debug::check 3.9.0-rc.2 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.9.0-rc.1 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.9.0-beta.5 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.9.0-beta.4 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.6 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.5 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.4 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.3 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.2 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.1 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.8.0 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.7.9 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.7.8 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.7.7 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.7.6 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.7.5 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.6.12 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.6.11 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.6.10 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.6.9 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.6.8 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.6.7 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.5.10 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.5.9 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.5.4 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.4.10 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.4.4 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.3.7 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.3.5 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.2.5 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.1.4 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 3.0.1 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 2.7.18 satisfies 3.9
[Build and Test/build]   💬  ::debug::check 2.7.17 satisfies 3.9
[Build and Test/build]   ❗  ::error::Version 3.9 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
[Build and Test/build]   ❌  Failure - Set up Python
Error: exit with `FAILURE`: 1

Is this a problem in my setup, a bug in act or a third party issue?

Originally created by @tomasaschan on GitHub (Nov 12, 2020). Original GitHub issue: https://github.com/nektos/act/issues/418 Consider the following definition: ``` jobs: build: runs-on: ubuntu-latest steps: - name: Set up Python uses: actions/setup-python@v2 with: python-version: "3.9" ``` This works when running on Github, as can be seen in the log [here](https://github.com/tomasaschan/hiplog/runs/1392543203?check_suite_focus=true) (that build fails on a later, unrelated, step) but when running locally with `act` it fails to find the 3.9 version, and logs the following output: ``` λ act [Build and Test/build] 🚀 Start image=node:12.6-buster-slim [Build and Test/build] 🐳 docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Build and Test/build] 🐳 docker cp src=/home/taschan/code/github/tomasaschan/hiplog/. dst=/github/workspace [Build and Test/build] ⭐ Run actions/checkout@v2 [Build and Test/build] ✅ Success - actions/checkout@v2 [Build and Test/build] ⭐ Run Set up Python [Build and Test/build] ☁ git clone 'https://github.com/actions/setup-python' # ref=v2 [Build and Test/build] 🐳 docker cp src=/home/taschan/.cache/act/actions-setup-python@v2 dst=/actions/ [Build and Test/build] 💬 ::debug::Semantic version spec of 3.9 is 3.9 [Build and Test/build] 💬 ::debug::isExplicit: [Build and Test/build] 💬 ::debug::explicit? false [Build and Test/build] 💬 ::debug::evaluating 0 versions [Build and Test/build] 💬 ::debug::match not found | Version 3.9 was not found in the local cache [Build and Test/build] 💬 ::debug::check 3.10.0-alpha.2 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.10.0-alpha.1 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.9.0 satisfies 3.9 [Build and Test/build] 💬 ::debug::x64===x64 && darwin===linux [Build and Test/build] 💬 ::debug::x64===x64 && linux===linux [Build and Test/build] 💬 ::debug::x64===x64 && linux===linux [Build and Test/build] 💬 ::debug::x64===x64 && linux===linux [Build and Test/build] 💬 ::debug::x64===x64 && win32===linux [Build and Test/build] 💬 ::debug::x86===x64 && win32===linux [Build and Test/build] 💬 ::debug::check 3.9.0-rc.2 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.9.0-rc.1 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.9.0-beta.5 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.9.0-beta.4 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.6 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.5 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.4 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.3 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.2 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.1 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.8.0 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.7.9 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.7.8 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.7.7 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.7.6 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.7.5 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.6.12 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.6.11 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.6.10 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.6.9 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.6.8 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.6.7 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.5.10 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.5.9 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.5.4 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.4.10 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.4.4 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.3.7 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.3.5 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.2.5 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.1.4 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 3.0.1 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 2.7.18 satisfies 3.9 [Build and Test/build] 💬 ::debug::check 2.7.17 satisfies 3.9 [Build and Test/build] ❗ ::error::Version 3.9 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 [Build and Test/build] ❌ Failure - Set up Python Error: exit with `FAILURE`: 1 ``` Is this a problem in my setup, a bug in `act` or a third party issue?
Author
Owner

@tomasaschan commented on GitHub (Nov 14, 2020):

I think I figured out what the problem is: On Github, ubuntu-latest seems to refer to Ubuntu 20.04, while act resolves it as 18.04. Specifying ubuntu-20.04 explicitly in the workflow definition doesn't work either, because that's not available at all in act.

My workaround was to build the following Docker image and tag it ubuntu-builder, and then run act -P ubuntu-latest=ubuntu-builder:

FROM ubuntu:20.04

RUN apt-get update \
    && apt-get upgrade -y \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    build-essential \
    curl \
    nodejs \
    npm \
    && rm -rf /var/lib/apt/lists/*

The reason it doesn't work with just act -P ubuntu-latest=ubuntu:20.04 is, it seems to me, that actions themselves need node to be installed. There currently is not a node image based on a recent enough Debian version, which I suppose is why act doesn't support this out of the box in the first place.

<!-- gh-comment-id:727261137 --> @tomasaschan commented on GitHub (Nov 14, 2020): I think I figured out what the problem is: On Github, `ubuntu-latest` seems to refer to Ubuntu 20.04, while `act` resolves it as 18.04. Specifying `ubuntu-20.04` explicitly in the workflow definition doesn't work either, because that's not available at all in `act`. My workaround was to build the following Docker image and tag it `ubuntu-builder`, and then run `act -P ubuntu-latest=ubuntu-builder`: ``` FROM ubuntu:20.04 RUN apt-get update \ && apt-get upgrade -y \ && DEBIAN_FRONTEND=noninteractive apt-get install -y \ build-essential \ curl \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* ``` The reason it doesn't work with just `act -P ubuntu-latest=ubuntu:20.04` is, it seems to me, that actions themselves need node to be installed. There currently is not a `node` image based on a recent enough Debian version, which I suppose is why `act` doesn't support this out of the box in the first place.
Author
Owner

@hugoprudente commented on GitHub (Nov 27, 2020):

@tomasaschan solution works for me too, thanks!

<!-- gh-comment-id:734906392 --> @hugoprudente commented on GitHub (Nov 27, 2020): @tomasaschan solution works for me too, thanks!
Author
Owner

@fericsepi commented on GitHub (Dec 9, 2020):

I think it fails to find any version really, I'm trying to pin it to Python 3.7.9 without much luck.
I tried even with ubuntu-18.04 and it cannot find the python version in the cache.
related lines:

💬  ::debug::Semantic version spec of 3.7.9 is 3.7.9
💬  ::debug::isExplicit: 3.7.9
💬  ::debug::explicit? true
💬  ::debug::checking cache: /opt/hostedtoolcache/Python/3.7.9/x64
💬  ::debug::not found | Version 3.7.9 was not found in the local cache
💬  ::debug::check 3.7.9 satisfies 3.7.9
❗  ::error::Version 3.7.9 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
❌  Failure - Set up Python 3.7.9
Error: exit with `FAILURE`: 1

What I would expect is that it downloads the relevant version if it's not available in the cache.

<!-- gh-comment-id:741818149 --> @fericsepi commented on GitHub (Dec 9, 2020): I think it fails to find any version really, I'm trying to pin it to Python 3.7.9 without much luck. I tried even with `ubuntu-18.04` and it cannot find the python version in the cache. related lines: ```terminal 💬 ::debug::Semantic version spec of 3.7.9 is 3.7.9 💬 ::debug::isExplicit: 3.7.9 💬 ::debug::explicit? true 💬 ::debug::checking cache: /opt/hostedtoolcache/Python/3.7.9/x64 💬 ::debug::not found | Version 3.7.9 was not found in the local cache 💬 ::debug::check 3.7.9 satisfies 3.7.9 ❗ ::error::Version 3.7.9 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 ❌ Failure - Set up Python 3.7.9 Error: exit with `FAILURE`: 1 ``` What I would expect is that it downloads the relevant version if it's not available in the cache.
Author
Owner

@catthehacker commented on GitHub (Dec 9, 2020):

Current image nektos/act-environments-ubuntu:18.04 contains only these versions:

root@2716efe7b530:/# ls -lh /opt/hostedtoolcache/Python/
total 28K
drwxr-xr-x 3 root root 4.0K Feb 18  2020 2.7.17
drwxr-xr-x 3 root root 4.0K Feb 18  2020 3.5.9
drwxr-xr-x 3 root root 4.0K Feb 18  2020 3.6.10
drwxr-xr-x 3 root root 4.0K Feb 18  2020 3.7.6
drwxr-xr-x 3 root root 4.0K Feb 18  2020 3.8.1

In order to use https://github.com/actions/setup-python on self-hosted runner (which what act does basically), there are few restrictions mentioned in the https://github.com/actions/setup-python#using-setup-python-with-a-self-hosted-runner

My guess is that's due to environment variable that is missing since the image doesn't source the /etc/environment file

The action in workflow I copied from issue author seems to work fine with my image (`ubuntu-20.04`):

asciicast

<!-- gh-comment-id:741833202 --> @catthehacker commented on GitHub (Dec 9, 2020): Current image `nektos/act-environments-ubuntu:18.04` contains only these versions: ``` root@2716efe7b530:/# ls -lh /opt/hostedtoolcache/Python/ total 28K drwxr-xr-x 3 root root 4.0K Feb 18 2020 2.7.17 drwxr-xr-x 3 root root 4.0K Feb 18 2020 3.5.9 drwxr-xr-x 3 root root 4.0K Feb 18 2020 3.6.10 drwxr-xr-x 3 root root 4.0K Feb 18 2020 3.7.6 drwxr-xr-x 3 root root 4.0K Feb 18 2020 3.8.1 ``` In order to use https://github.com/actions/setup-python on self-hosted runner (which what `act` does basically), there are few restrictions mentioned in the https://github.com/actions/setup-python#using-setup-python-with-a-self-hosted-runner My guess is that's due to environment variable that is missing since the image doesn't source the `/etc/environment` file <details> <summary>The action in workflow I copied from issue author seems to work fine with my image (`ubuntu-20.04`): </summary> [![asciicast](https://asciinema.org/a/kFFAw8F9KdyiycRRtBu0ZV3AM.svg)](https://asciinema.org/a/kFFAw8F9KdyiycRRtBu0ZV3AM) </details>
Author
Owner

@github-actions[bot] commented on GitHub (Jan 16, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:761279562 --> @github-actions[bot] commented on GitHub (Jan 16, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@tomasaschan commented on GitHub (Jan 18, 2021):

Commenting just to remove the stale label.

<!-- gh-comment-id:762083207 --> @tomasaschan commented on GitHub (Jan 18, 2021): Commenting just to remove the stale label.
Author
Owner

@catthehacker commented on GitHub (Jan 18, 2021):

Action setup-python requires some kind of Python version already available in /opt/hostedtoolcache, that's not possible to be fixed by modifying act itself, docker image used in act has to have that pre-requisite.

<!-- gh-comment-id:762095012 --> @catthehacker commented on GitHub (Jan 18, 2021): Action `setup-python` requires some kind of Python version already available in `/opt/hostedtoolcache`, that's not possible to be fixed by modifying `act` itself, docker image used in `act` has to have that pre-requisite.
Author
Owner

@pwoolvett commented on GitHub (Feb 10, 2021):

Tried this today, with act installed in a devcontainer (yo dawg),
actions/setup-python@v1 + ubuntu-latest landed me here.

This is working

    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v1
      - name: Set up Python 3.9
        uses: actions/setup-python@v2
        with:
          python-version: 3.9
<!-- gh-comment-id:776991860 --> @pwoolvett commented on GitHub (Feb 10, 2021): Tried this today, with act installed in a `devcontainer` (yo dawg), `actions/setup-python@v1` + `ubuntu-latest` landed me here. This is working ```yaml runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 - name: Set up Python 3.9 uses: actions/setup-python@v2 with: python-version: 3.9 ```
Author
Owner

@github-actions[bot] commented on GitHub (Mar 13, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:797829628 --> @github-actions[bot] commented on GitHub (Mar 13, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@amyb-asu commented on GitHub (Oct 3, 2024):

This is a major issue for us. Act works fine for a few people but everyone else has this error and can't run any of our workflows... I can't figure out what the difference between the working and not working are, since everyone is using the same recent build of catthehacker/ubuntu:act-latest as the runtime image. I don't understand why the action works for some people on that image but not for anyone else...

For context I am trying to use python version 3.10 (any sub version of that is fine... just need it to work)

<!-- gh-comment-id:2392338191 --> @amyb-asu commented on GitHub (Oct 3, 2024): This is a major issue for us. Act works fine for a few people but everyone else has this error and can't run any of our workflows... I can't figure out what the difference between the working and not working are, since everyone is using the same recent build of `catthehacker/ubuntu:act-latest` as the runtime image. I don't understand why the action works for some people on that image but not for anyone else... For context I am trying to use python version 3.10 (any sub version of that is fine... just need it to work)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#290
No description provided.