Act: Python 3.9 installation fails with act but works on Github

Created on 12 Nov 2020  ยท  4Comments  ยท  Source: nektos/act

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?

Most helpful comment

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.

All 4 comments

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.

@tomasaschan solution works for me too, thanks!

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.

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

Was this page helpful?
0 / 5 - 0 ratings