8000 Path issue with Windows runners · Issue #309 · runs-on/runs-on · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Path issue with Windows runners #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dblanchette opened this issue May 23, 2025 · 1 comment
Open

Path issue with Windows runners #309

dblanchette opened this issue May 23, 2025 · 1 comment

Comments

@dblanchette
Copy link

When running a Windows workflow using the official image you provide, we get errors running a Python shell:

Error: python: command not found

The runners launched with runs-on do not seem to have any tools on the path.

Are there extra steps needed?

Further investigation

name: Combined Matrix Windows Test
on:
  workflow_dispatch:
  push:

jobs:
  test:
    continue-on-error: true

    strategy:
      matrix:
        include:
          - name: Runs On
            runs-on: runs-on=${{ github.run_id }}/image=windows22-base-x64/family=m7i
          - name: GitHub Hosted
            runs-on: windows-latest

    name: ${{ matrix.name }}
    runs-on: ${{ matrix.runs-on }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Windows Debug Info (before setup Python)
        uses: ./.github/actions/windows-debug-info

      - name: A Python shell (before setup Python)
        shell: python
        continue-on-error: true
        run: print('Hello Python world!')

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.x'

      - name: Windows Debug Info (after setup Python)
        uses: ./.github/actions/windows-debug-info

      - name: A Python shell (after)
        shell: python
        run: print('Hello Python world!')

With .github/actions/windows-debug-info/action.yaml

name: windows-debug-info

description: windows-debug-info
runs:
  using: composite

  steps:
    - name: Check current dir
      shell: powershell
      run: |
        $PWD
        dir .

    - name: Check env variables
      shell: powershell
      run: |
        echo $env:USERNAME
        echo $env:RUNS_ON_RUNNER_NAME
        Get-ChildItem Env: | Format-Table -Wrap -AutoSize

    - name: Check Users
      shell: powershell
      run: |
        Get-LocalUser | Format-Table -AutoSize Name,Enabled,PasswordLastSet

    - name: Check Python executables
      shell: powershell
      run: |
        foreach ($programName in @("python", "python3", "git", "pip", "pip3", "poetry")) {
          try {
            Get-Command $programName | Format-Table -AutoSize
            & $programName --version
          } catch {
            Write-Host "$programName is not found"
          }
        }

Results

Runs On

Upon checkout, we get a warning To create a local Git repository instead, add Git 2.18 or higher to the PATH

The Path before setup-python:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShellv1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps   

This seems really short

None of the listed executables are found:

Run foreach ($programName in @("python", "python3", "git", "pip", "pip3", "poetry")) { ...
python is not found
python3 is not found
git is not found
pip is not found
pip3 is not found
poetry is not found

setup-python does prepend the same as on our image:

C:\Users\Administrator\AppData\Roaming\Python\Python313\Scripts;C:\actions-runner\_work\_tool\Python\3.13.3\x64\Scripts;C:\actions-runner\_work\_tool\Python\3.13.3\x64

After setup-python, we do have python, python3, pip, etc. on the path. Git is still not found. The Python shell works

GitHub hosted

Everything works. We get a very long path that includes all the tools we need (and many that we don't need)

@crohr
Copy link
Contributor
crohr commented May 28, 2025

@dblanchette Windows images are currently very bare-bone, so they have a lot of shortcomings in terms of supported software compared to GitHub-hosted runners. This is an area I want to improve in the coming weeks, I'll let you know once it's ready for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0