-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Running a python command task using image ghcr.io/actions/actions-runner:2.322.0 fails with "Error: python: command not found" #3709
Comments
i am not sure this is a bug , its look loke you dont have python install and you need to add this
|
Hi:
As per the github hosted action docs: "GitHub-hosted runners have a tools cache with pre-installed software, which includes Python and PyPy. You don't have to install anything! " If I understand correctly, an on-prem github action runner using the action container image should behave equivalently to a github-hosted action runner (with certain caveats regarding ephemerality etc.). The difference / (the bug?) is that python3 is pre-installed in the container image - but is only accessible using python3 as the command to invoke the interpreter. This differs between a github hosted action runner and a self-hosted action runner using the container image. When you run a step using the python shell option, it fails, as this translates to executing There is no symlink from python to python3 however in the container, so you get a command not found exception (as nothing in the container has an executable called "python". If you manually run (in the container, on the host as root)
This effectively create a symlink from python to python3, and then the step can complete successfully, as there is now a "python" executable in the path. For reference, this runs on a github-hosted runner: name: Run github-hosted activity
on:
workflow_dispatch:
jobs:
validate_inputs:
name: Validating Inputs
runs-on: ubuntu-latest
steps:
- name: Checkout Source
id: checkout_source
uses: actions/checkout@v4
- name: echo hostname (Python)
id: echo_hostname
shell: python
run: |
"""output host info """
import os
import uuid
import platform
def write_step_summary(message: str):
"""
Write to the step output summary.
"""
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as fh:
print(message, file=fh)
print(message)
hostname = platform.node()
write_step_summary('# Container Information')
write_step_summary(f"Executing on *{ hostname }*") |
Is this issue in the wrong repo - should it be in https://github.com/actions/runner-images/issues? |
Describe the bug
Using the github runner's container image fails if using
shell: python
.There is no alias to python in the image.
Manually entering the running container and running:
resolves the issue - this should be part of the image build.
To Reproduce
Steps to reproduce the behaviour:
A clear and concise description of what you expected to happen.
The inline python script should execute if
shell: python
is specifiedRunner Version and Platform
Version of your runner?
OS of the machine running the runner?
What's not working?
Please include error messages and screenshots.
Job Log Output
If applicable, include the relevant part of the job / step log output here. All sensitive information should already be masked out, but please double-check before pasting here.
Runner and Worker's Diagnostic Logs
The text was updated successfully, but these errors were encountered: