actions / setup-python

Set up your GitHub Actions workflow with a specific version of Python
MIT License
1.64k stars 528 forks source link

Self-hosted Windows Runner Fails to Install Python #904

Closed dnwillia-work closed 3 days ago

dnwillia-work commented 1 month ago

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:

Runner type:

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.

RobPasMue commented 1 month ago

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

aparnajyothi-y commented 1 month ago

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

dnwillia-work commented 1 month ago

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

priyagupta108 commented 3 weeks ago

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?

SMoraisAnsys commented 3 weeks ago

It just worked on my CICD, see bellow

image

priyagupta108 commented 2 weeks ago

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 commented 3 days ago

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!