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

Doesn't work on windows

Open sijjay opened this issue 9 months ago • 3 comments

Description: Trying to e this action on elf-hosted windows runners

    - uses: actions/setup-python@v5
      with:
        python-version: ${{ inputs.python_version }}

Action version: v5

Platform:

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

Runner type:

  • [ ] Hosted
  • [x] Self-hosted

Tools version:

Python 3.10 Windows_NT

Repro steps:
Just run this action on Windwos_NT

Expected behavior: Works smoothly as it does on Linux

Actual behavior: Error:

Run actions/setup-python@v5
  
Installed versions
  Version 3.10 was not found in the local cache
  Version 3.10 is available for downloading
  Download from "https://github.com/actions/python-versions/releases/download/3.10.11-11114431484/python-3.10.11-win32-x64.zip"
  Extract downloaded archive
  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 'E:\actions-runner\_work\_temp\python-3.10.11-win32-x64.zip' -DestinationPath 'E:\actions-runner\_work\_temp\98799a9c-7702-4d8c-bbda-57b256f4beef' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('E:\actions-runner\_work\_temp\python-3.10.11-win32-x64.zip', 'E:\actions-runner\_work\_temp\98799a9c-7702-4d8c-bbda-57b256f4beef', $true) }"
  Execute installation script
  Windows PowerShell
  Copyright (C) 2014 Microsoft Corporation. All rights reserved.
  ********************************************************
  *********     THIS IS A PRODUCTION SYSTEM!     *********
  ********************************************************
  Please use extreme caution in this environment...
  Check if Python hostedtoolcache folder exist...
  Create Python toolcache folder
  Check if current Python version is installed...
  No Python3.10.* found
  Remove registry entries for Python 3.10(x64)...
  Create Python 3.10.11 folder in E:\actions-runner\_work\_tool\Python
  Copy Python binaries to E:\actions-runner\_work\_tool\Python\3.10.11\x64
  Install Python 3.10.11 in E:\actions-runner\_work\_tool\Python...
  Error: Error happened during Python installation
  Error: At E:\actions-runner\_work\_temp\98799a9c-7702-4d8c-bbda-57b256f4beef\setup.ps1:127 char:5
  +     Throw "Error happened during Python installation"
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : OperationStopped: (Error happened ...on installation:String) [], RuntimeException
      + FullyQualifiedErrorId : Error happened during Python installation
  Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1

sijjay avatar Mar 21 '25 19:03 sijjay

This is occurring for me also. I followed the guidance for self hosted windows, with no change.

AdamBryantLaunchWindow avatar Mar 21 '25 23:03 AdamBryantLaunchWindow

Hi @sijjay , Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

suyashgaonkar avatar Mar 24 '25 04:03 suyashgaonkar

Hello there👋, Thank you for reporting this issue. We were unable to reproduce the error on our end, and it appears to be related to the runner configuration setup rather than the setup-python action. The error you are experiencing could be due to the following reasons:

  • Administrator Privileges: Ensure that your self-hosted runner is running with administrator privileges. This is necessary for setting up the appropriate directories and files when downloading and installing a new version of Python. If your runner is configured as a service, make sure the account that is running the service has the appropriate write permissions so that Python can get installed. Please refer to the documentation for further details related to using setup-python with a self-hosted runner.

  • Disk Space: Ensure that the runner has sufficient disk space. Lack of adequate space can hinder the installation of Python and other necessary packages.

  • Concurrency Issues: If multiple processes attempt to access or modify the same resources (such as the Python installation directory), it could lead to conflicts and cause the installation to fail.

For further troubleshooting, we recommend re-running the job and trying different Python versions with actions/setup-python@v5. Additionally, you can clear any existing tool cache in your runner using the following snippet and re-run the workflow:

- name: Clear any existing tool cache
  run: |
    mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
    mkdir -p "${{ runner.tool_cache }}"
- uses: actions/setup-python@v5
  with:
    python-version: ‘3.x’

We hope this information is helpful. Please let us know if you have any further questions or concerns.

priya-kinthali avatar Mar 26 '25 06:03 priya-kinthali

Hello @sijjay👋, Just giving you a gentle ping to see if there have been any updates or if any of the suggested workarounds helped resolve the issue. Thank you!

priya-kinthali avatar Apr 02 '25 09:04 priya-kinthali

self hosted runner : This is occurring for me also.

arunk3200 avatar Apr 08 '25 12:04 arunk3200

Hello @arunk3200👋, Could you please try the troubleshooting steps mentioned in the previous comment and let us know if that helps resolve the issue? It could be related to the runner configuration setup. Hello @sijjay👋, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know. Thank you!

priya-kinthali avatar Apr 09 '25 05:04 priya-kinthali

Hello @priya-kinthali, Below recommendation works for me on Windows Self hosted runner.

  • name: Clear any existing tool cache run: | mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old" mkdir -p "${{ runner.tool_cache }}"
  • uses: actions/setup-python@v5 with: python-version: ‘3.x’

arunk3200 avatar Apr 09 '25 06:04 arunk3200

Hello @sijjay👋, We’ll proceed with closing this issue for now, as we haven’t received a response. Please feel free to reopen it or reach out to us if needed. Thank you! 😊

priya-kinthali avatar Apr 16 '25 06:04 priya-kinthali