nektos / act

Run your GitHub Actions locally πŸš€
https://nektosact.com
MIT License
55.36k stars 1.38k forks source link

Unable to execute actions/setup-python #251

Closed rgarrigue closed 3 years ago

rgarrigue commented 4 years ago

Hi there

Thanks for act. I've been using it successfully until now, but here's some issue running python related tests : it's unable to execute the setup-python action.

I tried with both my "old" act version from a couple of month ago and latest 0.2.8 from GitHub releases. With and without the matrix on python version. With actions/checkout@v1, v2 and master.

name: Tests
jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python: [3.7]
    steps:
      - uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python }}

And here's the verbose log

act -v
DEBU[0000] Loading environment from /home/me/work/ansible/ansible-role-apns-proxy/.env 
DEBU[0000] Loading secrets from                         
DEBU[0000] Loading workflows from '/home/me/work/ansible/ansible-role-apns-proxy/.github/workflows' 
DEBU[0000] Reading workflow '/home/me/work/ansible/ansible-role-apns-proxy/.github/workflows/tests.yml' 
DEBU[0000] Planning event: push                         
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
[Tests/tests] πŸ§ͺ  Matrix: map[python:3.7]
[Tests/tests] πŸš€  Start image=node:12.6-buster-slim
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
[Tests/tests]   🐳  docker pull node:12.6-buster-slim
DEBU[0000] Image exists? true                           
[Tests/tests] Removed container: b1b835d656c4caa59f87c9ace1c2764c917fb223c34283c3ec1fdd75c6609b31
[Tests/tests]   🐳  docker create image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Tests/tests] Created container name=act-Tests-tests id=5e1ee21708b4923783ef87aad72db2f09e899f30e64e185bde4a6f694517e15d from image node:12.6-buster-slim
[Tests/tests] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_TEMP=/tmp]
[Tests/tests]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Tests/tests] Starting container: 5e1ee21708b4923783ef87aad72db2f09e899f30e64e185bde4a6f694517e15d
[Tests/tests] Started container: 5e1ee21708b4923783ef87aad72db2f09e899f30e64e185bde4a6f694517e15d
[Tests/tests]   🐳  docker cp src=/home/me/work/ansible/ansible-role-apns-proxy/. dst=/github/workspace
[Tests/tests] Exec command '[mkdir -p /github/workspace]'
DEBU[0000] Writing tarball /tmp/act508945956 from /home/me/work/ansible/ansible-role-apns-proxy/. 
DEBU[0000] Stripping prefix:/home/me/work/ansible/ansible-role-apns-proxy/ src:/home/me/work/ansible/ansible-role-apns-proxy/. 
[Tests/tests] Unable to copy link converge.yml --> ../default/converge.yml
[Tests/tests] Unable to copy link requirements.yml --> ../default/requirements.yml
[Tests/tests] Unable to copy link tests --> ../default/tests
[Tests/tests] Extracting content from '/tmp/act508945956' to '/github/workspace'
DEBU[0000] Writing entry to tarball workflow/event.json len:2 
DEBU[0000] Writing entry to tarball home/.act len:0     
[Tests/tests] Extracting content to '/github/'
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
DEBU[0000] setupEnv => map[GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_REF:refs/tags/test GITHUB_REPOSITORY:TinxHQ/ansible-role-apns-proxy GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SHA:10b2eb0f8ae364f1c3086b27315b76aebdf6722a GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
DEBU[0000] context env => map[GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_REF:refs/tags/test GITHUB_REPOSITORY:TinxHQ/ansible-role-apns-proxy GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SHA:10b2eb0f8ae364f1c3086b27315b76aebdf6722a GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
[Tests/tests] ⭐  Run actions/checkout@v2
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
[Tests/tests] Skipping actions/checkout
[Tests/tests]   βœ…  Success - actions/checkout@v2
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
DEBU[0000] setupEnv => map[GITHUB_ACTION:1 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_REF:refs/tags/test GITHUB_REPOSITORY:TinxHQ/ansible-role-apns-proxy GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SHA:10b2eb0f8ae364f1c3086b27315b76aebdf6722a GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home INPUT_PYTHON-VERSION:3.7] 
DEBU[0000] Loading slug from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] Loading revision from git directory '/home/me/work/ansible/ansible-role-apns-proxy/.git' 
DEBU[0000] Found revision: 10b2eb0f8ae364f1c3086b27315b76aebdf6722a 
DEBU[0000] HEAD points to '10b2eb0f8ae364f1c3086b27315b76aebdf6722a' 
DEBU[0000] HEAD matches refs/tags/test                  
DEBU[0000] using github ref: refs/tags/test             
DEBU[0000] context env => map[GITHUB_ACTION:1 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_REF:refs/tags/test GITHUB_REPOSITORY:TinxHQ/ansible-role-apns-proxy GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SHA:10b2eb0f8ae364f1c3086b27315b76aebdf6722a GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home INPUT_PYTHON-VERSION:3.7] 
[Tests/tests] ⭐  Run Setup Python
[Tests/tests]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v2
[Tests/tests]   cloning https://github.com/actions/setup-python to /home/me/.cache/act/actions-setup-python@v2
[Tests/tests] Cloned https://github.com/actions/setup-python to /home/me/.cache/act/actions-setup-python@v2
[Tests/tests] Checked out v2
DEBU[0001] Read action &{Setup Python GitHub Set up a specific version of Python and add the command-line tools to the PATH. map[architecture:{The target architecture (x86, x64) of the Python interpreter. false } python-version:{Version range or exact version of a Python version to use, using SemVer's version range syntax. false 3.x} token:{Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user. false ${{ github.token }}}] map[python-version:{The installed python version. Useful when given a version range as input.}] {node12 map[] dist/index.js  [] []} {yellow code}} from '/home/me/.cache/act/actions-setup-python@v2/action.yml' 
DEBU[0001] About to run action &{Setup Python GitHub Set up a specific version of Python and add the command-line tools to the PATH. map[architecture:{The target architecture (x86, x64) of the Python interpreter. false } python-version:{Version range or exact version of a Python version to use, using SemVer's version range syntax. false 3.x} token:{Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user. false ${{ github.token }}}] map[python-version:{The installed python version. Useful when given a version range as input.}] {node12 map[] dist/index.js  [] []} {yellow code}} 
DEBU[0001] type=3 actionDir=/home/me/.cache/act/actions-setup-python@v2 Workdir=/home/me/work/ansible/ansible-role-apns-proxy ActionCacheDir=/home/me/.cache/act actionName=actions-setup-python@v2 containerActionDir=/actions 
[Tests/tests]   🐳  docker cp src=/home/me/.cache/act/actions-setup-python@v2 dst=/actions/
[Tests/tests] Exec command '[mkdir -p /actions/]'
DEBU[0001] Writing tarball /tmp/act255484723 from /home/me/.cache/act/actions-setup-python@v2 
DEBU[0001] Stripping prefix:/home/me/.cache/act/ src:/home/me/.cache/act/actions-setup-python@v2 
[Tests/tests] Extracting content from '/tmp/act255484723' to '/actions/'
[Tests/tests] Exec command '[node /actions/actions-setup-python@v2/dist/index.js]'
[Tests/tests]   πŸ’¬  ::debug::Semantic version spec of 3.7 is 3.7
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 
[Tests/tests]   πŸ’¬  ::debug::explicit? false
[Tests/tests]   πŸ’¬  ::debug::evaluating 0 versions
[Tests/tests]   πŸ’¬  ::debug::match not found
| Version 3.7 was not found in the local cache
[Tests/tests]   ❗  ::error::Bad credentials
[Tests/tests]   ❌  Failure - Setup Python
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
DEBU[0002] exit with `FAILURE`: 1                       
Error: exit with `FAILURE`: 1
svdgraaf commented 4 years ago

I've hit the same issue, I've found that if you set a GITHUB_TOKEN env var, it doesn't give the bad credentials error, and proceeds, only to fail a bit later:

$ GITHUB_TOKEN=foobar act
...
[tests.yml/tests]   ❗  ::error::Version 3.8 with arch x64 not found%0AThe list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json
[tests.yml/tests]   ❌  Failure - Setup Python
svdgraaf commented 4 years ago

I'm not sure, but I think it fails because I'm running it on osx, but the installation is running through the docker container on linux, and it's not understanding which version it should install. I think? :)

The manifest does contain the right version it should use: https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json


[tests.yml/tests]   πŸ’¬  ::debug::Semantic version spec of 3.8.3 is 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::isExplicit: 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::explicit? true
[tests.yml/tests]   πŸ’¬  ::debug::checking cache: /opt/hostedtoolcache/Python/3.8.3/x64
[tests.yml/tests]   πŸ’¬  ::debug::not found
| Version 3.8.3 was not found in the local cache
[tests.yml/tests]   πŸ’¬  ::debug::check 3.8.3 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::x64===x64 && darwin===linux
[tests.yml/tests]   πŸ’¬  ::debug::x64===x64 && darwin===linux
[tests.yml/tests]   πŸ’¬  ::debug::x64===x64 && linux===linux
[tests.yml/tests]   πŸ’¬  ::debug::x64===x64 && linux===linux
[tests.yml/tests]   πŸ’¬  ::debug::x64===x64 && win32===linux
[tests.yml/tests]   πŸ’¬  ::debug::x86===x64 && win32===linux
[tests.yml/tests]   πŸ’¬  ::debug::check 3.8.2 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.8.1 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.8.0 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.7.7 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.7.6 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.7.5 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.6.10 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.6.9 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.6.8 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.6.7 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.5.9 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 3.5.4 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 2.7.18 satisfies 3.8.3
[tests.yml/tests]   πŸ’¬  ::debug::check 2.7.17 satisfies 3.8.3
[tests.yml/tests]   ❗  ::error::Version 3.8.3 with arch x64 not found%0AThe list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json
[tests.yml/tests]   ❌  Failure - Setup Python
DEBU[0003] exit with `FAILURE`: 1```
rgarrigue commented 4 years ago

For the records I'm running it under Ubuntu 19.10

whettie commented 4 years ago

So good.

RaulBSantos commented 4 years ago

Same here, and I'm using ElementaryOS under Ubuntu 18.04.4.

Some of you guys tried with another image? Just wondering if this may solve, cause I couldn't try with the alternative image, my disk space it's insufficient :(

rgarrigue commented 4 years ago

@RaulBSantos it does work running

act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04

...
[Tests/tests] ⭐  Run Setup Python
[Tests/tests]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v2
[Tests/tests]   🐳  docker cp src=/home/remy/.cache/act/actions-setup-python@v2 dst=/actions/
[Tests/tests]   πŸ’¬  ::debug::Semantic version spec of 3.7 is 3.7
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 
[Tests/tests]   πŸ’¬  ::debug::explicit? false
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 2.7.17
[Tests/tests]   πŸ’¬  ::debug::explicit? true
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 3.5.9
[Tests/tests]   πŸ’¬  ::debug::explicit? true
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 3.6.10
[Tests/tests]   πŸ’¬  ::debug::explicit? true
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 3.7.6
[Tests/tests]   πŸ’¬  ::debug::explicit? true
[Tests/tests]   πŸ’¬  ::debug::isExplicit: 3.8.1
[Tests/tests]   πŸ’¬  ::debug::explicit? true
[Tests/tests]   πŸ’¬  ::debug::evaluating 5 versions
[Tests/tests]   πŸ’¬  ::debug::matched: 3.7.6
[Tests/tests]   πŸ’¬  ::debug::checking cache: /opt/hostedtoolcache/Python/3.7.6/x64
[Tests/tests]   πŸ’¬  ::debug::Found tool in cache Python 3.7.6 x64
[Tests/tests]   βš™  ::set-env:: pythonLocation=/opt/hostedtoolcache/Python/3.7.6/x64
[Tests/tests]   βš™  ::add-path:: /opt/hostedtoolcache/Python/3.7.6/x64
[Tests/tests]   βš™  ::add-path:: /opt/hostedtoolcache/Python/3.7.6/x64/bin
[Tests/tests]   βš™  ::set-output:: python-version=3.7.6
| Successfully setup CPython (3.7.6)
[Tests/tests]   ❓  ##[add-matcher]/actions/actions-setup-python@v2/.github/python.json
[Tests/tests]   βœ…  Success - Setup Python
...

Since that's fine enought for me I'll add the -P option to my .actrc.

For other user willing to push the investigation, the setup-python author suggested following this guideline https://github.com/actions/setup-python#using-setup-python-with-a-self-hosted-runner. I gave it a quick shot without success.

april commented 4 years ago

Yep, I'm having the exact same problem here as well. On macOS, always gives me the the Version ... with arch x64 not found error, even if I specify something as specific as 3.8.3.

Setting the .actrc as specified above did fix things, however.

grische commented 4 years ago

I created a simple test file which re-creates the problem

name: pull_requests
on: [pull_request]

jobs:
  test_pr:
    runs-on: ubuntu-18.04
    steps:
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.7"

It is fixed by adding the -P parameter like the following:

$ act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 pull_request
[pull_requests/test_pr] πŸš€  Start image=nektos/act-environments-ubuntu:18.04
[pull_requests/test_pr]   🐳  docker run image=nektos/act-environments-ubuntu:18.04 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[pull_requests/test_pr] ⭐   Run Set up Python
[pull_requests/test_pr]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v2
[pull_requests/test_pr]   🐳  docker cp src=/home/user/.cache/act/actions-setup-python@v2 dst=/actions/
[pull_requests/test_pr]   πŸ’¬  ::debug::Semantic version spec of 3.7 is 3.7
[pull_requests/test_pr]   πŸ’¬  ::debug::isExplicit:
[pull_requests/test_pr]   πŸ’¬  ::debug::explicit? false
[pull_requests/test_pr]   πŸ’¬  ::debug::isExplicit: 2.7.17
[pull_requests/test_pr]   πŸ’¬  ::debug::explicit? true
[pull_requests/test_pr]   πŸ’¬  ::debug::isExplicit: 3.5.9
[pull_requests/test_pr]   πŸ’¬  ::debug::explicit? true
[pull_requests/test_pr]   πŸ’¬  ::debug::isExplicit: 3.6.10
[pull_requests/test_pr]   πŸ’¬  ::debug::explicit? true
[pull_requests/test_pr]   πŸ’¬  ::debug::isExplicit: 3.7.6
[pull_requests/test_pr]   πŸ’¬  ::debug::explicit? true
[pull_requests/test_pr]   πŸ’¬  ::debug::isExplicit: 3.8.1
[pull_requests/test_pr]   πŸ’¬  ::debug::explicit? true
[pull_requests/test_pr]   πŸ’¬  ::debug::evaluating 5 versions
[pull_requests/test_pr]   πŸ’¬  ::debug::matched: 3.7.6
[pull_requests/test_pr]   πŸ’¬  ::debug::checking cache: /opt/hostedtoolcache/Python/3.7.6/x64
[pull_requests/test_pr]   πŸ’¬  ::debug::Found tool in cache Python 3.7.6 x64
[pull_requests/test_pr]   βš™  ::set-env:: pythonLocation=/opt/hostedtoolcache/Python/3.7.6/x64
[pull_requests/test_pr]   βš™  ::add-path:: /opt/hostedtoolcache/Python/3.7.6/x64
[pull_requests/test_pr]   βš™  ::add-path:: /opt/hostedtoolcache/Python/3.7.6/x64/bin
[pull_requests/test_pr]   βš™  ::set-output:: python-version=3.7.6
| Successfully setup CPython (3.7.6)
[pull_requests/test_pr]   ❓   ##[add-matcher]/actions/actions-setup-python@v2/.github/python.json
[pull_requests/test_pr]   βœ…   Success - Set up Python

Here are the respective lines from the setup-python action: https://github.com/actions/setup-python/blob/807b74f98ca701f414ddaa8a4187e7cffa93cbbd/dist/index.js#L999-L1023

Here is my lsb-release file:

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
$ uname -a
Linux DESKTOP-WINDOWS10 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

EDIT: Removed my previous invalid comment

imbillow commented 4 years ago

the problem still exists

dskvr commented 4 years ago

In order for this to work, one would write a docker file using nektos/act-environments-ubuntu:18.04 as a base image (FROM nektos/act-environments-ubuntu:18.04) that would need to include all caveats listed here.

Sounds like @rgarrigue tried something like this without success. Bummer.

raleighlittles commented 4 years ago

Still having this problem as well, running Ubuntu 20.04.1 LTS, with 5.4.0-42-generic as my kernel (if that helps or matters at all).

dustydecapod commented 4 years ago

Still a frelling issue

maxphillipsdev commented 4 years ago

I just ran into this issue as well :( Screen Shot 2020-09-21 at 7 33 04 PM

rickstaa commented 4 years ago

I solved this by using the method explained by @grische.

noliran commented 4 years ago

Found the problem - @actions/tool-cache:lib/manifest.js uses _readLinuxVersionFile() to determine the version of the ubuntu distribution using the line DISTRIB_RELEASE=18.04 in /etc/lsb-release . This file doesn't exist in node:12.6-buster-slim, the default image act currently uses. I'm currently using this as workaround:

      - run: |
          # Hack to get setup-python to work on act
          if [ ! -f "/etc/lsb-release" ] ; then
            echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release
          fi

Not really sure what's the right fix here - It doesn't make sense that @actions/setup-python treats Ubuntu's release version as platform_version and hands out Python versions based on it. That doesn't make sense..

charlielito commented 4 years ago

Same problem with Ubuntu20.04, @noliran solution solved it

rickstaa commented 4 years ago

@noliran his solution worked for me. I use it in the following way:

# Pull request ci config file
# Note: For local testing with https://github.com/nektos/act use the
# `sudo act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04` command.
name: MLC pull CI

on:
  # Trigger the workflow on a pull request,
  # but only for the master branch
  pull_request:
    branches:
      - master

jobs:
  build:
    name: runner / build
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: local-fix
        run: |
          # Hack to get setup-python to work on act
          # (see https://github.com/nektos/act/issues/251)
          if [ ! -f "/etc/lsb-release" ] ; then
            echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release
          fi
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.8"
rickstaa commented 4 years ago

Related to this pull request https://github.com/actions/toolkit/pull/594.

github-actions[bot] commented 3 years ago

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

raleighlittles commented 3 years ago

The PR fixing this issue still hasn't been merged.

bashbang commented 3 years ago

This has still been a problem for me on my OSX. I incorporated the "hack" that @noliran mentioned above and deleted the /Users/{myusername}/.cache/act/* and now works as expected.

      - run: |
          # Hack to get setup-python to work on act
          if [ ! -f "/etc/lsb-release" ] ; then
            echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release
          fi
github-actions[bot] commented 3 years ago

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

dgw commented 3 years ago

Still waiting on actions/toolkit#594

catthehacker commented 3 years ago

Hi all, if you will use medium or large image (https://github.com/nektos/act#runners) there shouldn't be any problem as those include lsb-release which will successfully provide OS version to setup-python. As this is external issue, I will close this.

GatlenCulp commented 3 months ago

It's 2024 and this is still an issue

GatlenScreen_001029  2024-07-22_14 42  (Code)@2x

GatlenScreen_001035  2024-07-22_14 44  (Code)@2x

GatlenScreen_001031  2024-07-22_14 42  (Code)@2x

GatlenScreen_001033  2024-07-22_14 43  (Code)@2x