Skip to content
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

exec.exec fails to execute python executables in windows runners #992

Open
LilSpazJoekp opened this issue Feb 2, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@LilSpazJoekp
Copy link

Describe the bug
Initially we were thinking it was pip version 22.* that was causing the issue because installing pip version 21.3.1 before the pre-commit action step would allow it to run successfully. Since the failure was in the pre-commit action I opened an issue (pre-commit/action#141) but I got told this issue was upstream. After digging into the code of the pre-commit action and tweaking the code in the pre-commit action, it also failed on execution of the pre-commit executable as well.

Running python executables will fail with the following error:

'C:\hostedtoolcache\windows\Python\3.10.1\x64\<executable>.exe' failed with exit code 3221225477

Looking up this error it appears to be a permission issue with the executables.

I'm not sure if this is where the issue actually lies but this is the next upstream spot it could be at.

To Reproduce

const exec = require('@actions/exec');
async function main() {
    await exec.exec('pip', ['install', 'pre-commit']);
    await exec.exec('pip', ['freeze', '--local']);
    await exec.exec('pre-commit', args);
}

I feel the above should work as well since it works just fine on other platforms.
I was able to get things working properly if I execute them as modules:

await exec.exec('python', ['-m', 'pip', 'install', 'pre-commit']);

Expected behavior
These calls should execute successfully.

Version Info
Using the latest version of the windows runner:

Current runner version: '2.287.1'
Operating System
  Microsoft Windows Server 2019
  10.0.17763
  Datacenter

This also uses the actions/setup-python@v2 action with CPython (3.10.1).

Additional context
https://github.com/praw-dev/praw/runs/5028100257?check_suite_focus=true#step:6:8
https://github.com/praw-dev/praw/runs/5043547347?check_suite_focus=true#step:6:20
https://github.com/praw-dev/praw/runs/5043313657?check_suite_focus=true#step:6:65
praw-dev/praw#1843
praw-dev/praw#1844
pre-commit/action#141

@aminya
Copy link

aminya commented Feb 5, 2022

@LilSpazJoekp Thank you for your solution. I can confirm that the pre-installed pip is broken on Windows images. The workaround is to use python -m pip install package

simonwiles added a commit to simonwiles/precommit-action that referenced this issue Mar 1, 2022
simonwiles added a commit to simonwiles/precommit-action that referenced this issue Mar 1, 2022
simonwiles added a commit to simonwiles/precommit-action that referenced this issue Mar 1, 2022
simonwiles added a commit to simonwiles/precommit-action that referenced this issue Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants