setup-python icon indicating copy to clipboard operation
setup-python copied to clipboard

Self-hosted Windows Runner Fails to Install Python

Open dnwillia-work opened this issue 1 year ago • 3 comments

Description: The action fails to install Python on a Windows 10 self-hosted runner. The following error is encountered:

 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'D:\ANSYSDev\actions-runner\_work\_temp\14631187-76a2-41c4-a7d1-8e9f15a8ab70' -DestinationPath 'D:\ANSYSDev\actions-runner\_work\_temp\e4873571-c293-4d72-ac71-50341e9e0d70' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('D:\ANSYSDev\actions-runner\_work\_temp\14631187-76a2-41c4-a7d1-8e9f15a8ab70', 'D:\ANSYSDev\actions-runner\_work\_temp\e4873571-c293-4d72-ac71-50341e9e0d70', $true) }"  
  Expand-Archive :  is not a supported archive file format. .zip is the only supported archive file format.
  At line:1 char:210
  + ...  Ignore)) { Expand-Archive -LiteralPath 'D:\ANSYSDev\actions-runner\_ ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidArgument: (:String) [Expand-Archive], IOException
      + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive

This is working on the GitHub windows-latest-8-core runner. It seems setup-python is not the only one impacted. eg:

https://github.com/actions/setup-go/issues/241

I have both Powershell 5.1 and 7.4.3 installed but as you can see the action seems to be picking the former.

Action version: v5

Platform:

  • [ ] Ubuntu
  • [ ] macOS
  • [x] Windows

Runner type:

  • [ ] Hosted
  • [x] Self-hosted

Tools version: 3.10

Repro steps:
I simply added the following into my CI workflow file and it fails.

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.10'

Expected behavior: Python is downloaded and unzipped, the action works as expected.

Actual behavior: It's not downloaded and installed.

dnwillia-work avatar Jul 04 '24 20:07 dnwillia-work

Related to https://github.com/actions/setup-python/issues/819

RobPasMue avatar Jul 05 '24 09:07 RobPasMue

Hello @dnwillia-work, Thank you for creating this issue and we will look into it :)

aparnajyothi-y avatar Jul 05 '24 13:07 aparnajyothi-y

@aparnajyothi-y No problem. @RobPasMue suggested I try v4 as a workaround and I can confirm that this is working.

dnwillia-work avatar Jul 05 '24 16:07 dnwillia-work

Hi @dnwillia-work 👋, We've merged PR #916 into the main branch with a potential fix. Could you please confirm that it works as expected for actions/setup-python@main?

priyagupta108 avatar Aug 08 '24 08:08 priyagupta108

It just worked on my CICD, see bellow

image

SMoraisAnsys avatar Aug 08 '24 08:08 SMoraisAnsys

Hi @dnwillia-work 👋,

Just following up to see if you've had a chance to test the fix merged in PR #916 with actions/setup-python@main. Could you please confirm if it resolves the issue?

Thanks!

priyagupta108 avatar Aug 16 '24 13:08 priyagupta108

Hello @dnwillia-work 👋, As previously mentioned, we've merged PR #916 into the main branch with a potential fix, which will be included in the upcoming release of actions/setup-python. I am closing this issue now. If you encounter any further issues, please feel free to reopen or create a new issue. Thank you for your understanding and cooperation!

priyagupta108 avatar Aug 27 '24 13:08 priyagupta108