restore-virtualenv icon indicating copy to clipboard operation
restore-virtualenv copied to clipboard

Consider Python launcher fallback on Windows

Open carsonyl opened this issue 3 years ago • 2 comments

On Windows, please consider falling back to invoking py if python isn't present on the path.

In my situation, I'm using a self-hosted runner on Windows, and using an installed Python 3.9 instead of actions/setup-python. I access it via py, the Python Launcher for Windows, because I have it on the path and not python.exe. py works in my workflow steps. I was hoping to use this action to avoid unnecessarily running py -m venv .venv for each run.

Likely less relevant: My Python 3.9 is also installed as a Microsoft Store app. py can still successfully launch Python even though the self-hosted runner is running as NT AUTHORITY\NETWORK SERVICE.

Log output:

Run syphar/restore-virtualenv@v1
::save-state name=VIRTUALENV_DIRECTORY::undefinedundefined\.virtualenvs\.venv
##[debug]Save intra-action state VIRTUALENV_DIRECTORY = undefinedundefined\.virtualenvs\.venv
::set-output name=virtualenv-directory::undefinedundefined\.virtualenvs\.venv
##[debug]steps['cache-virtualenv']['outputs']['virtualenv-directory']='undefinedundefined\.virtualenvs\.venv'
Error: Unable to locate executable file: python. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

carsonyl avatar Mar 05 '21 07:03 carsonyl

@carsonyl good idea, I always want to make it work for more people, if easily achievable.

Since I didn't work with windows for > 12 years: How could we easily test this in a github hosted runner? Can I run the Python Launcher for Windows in my testing-action?

syphar avatar Mar 05 '21 07:03 syphar

This problem seems to be inherent to self-hosted runners on Windows that aren't using actions/setup-python, so I don't have a good answer for how to test it. I imagine it's a very obscure scenario.

This issue isn't critical: I can work around it by adding python to the path. If I can solve the issue that's preventing me from using actions/setup-python, then even better.

carsonyl avatar Mar 05 '21 08:03 carsonyl