The following are some gotchas when setting up specific Python versions on GitHub self-hosted runners which are based on AWS official AMIs and container images.
-
Official Amazon Linux 2 AMI and official Amazon Linux 2 container image do not have the same Python runtimes setup.
- Amazon Linux 2 AMI (ECS-optimized AMI
/aws/service/ecs/optimized-ami/amazon-linux-2/recommended
) haspython2.7
andpython3.7
by default. - Amazon Linux 2 container image amazonlinux/amazonlinux (
public.ecr.aws/amazonlinux/amazonlinux
) has onlypython2.7
; it does not havepython3
/pip
installed by default.
- Amazon Linux 2 AMI (ECS-optimized AMI
Amazon Linux 2 AMI has
python3
pointed topython3.7
by default. When changingpython3
to point to other Python3 version (e.g. settingupdate-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
), it may breakcfn-signal
so no signal will be sent to ASG at EC2 launch (i.e. no healthy instances will be registered).
Note that this will be an issue if you use ASG for the runners (not ECS Fargate).-
Keep
python
to point topython2.7
, asyum
does not support Python3. You will see this error if settingpython
to point to Python3:
> yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax
See also https://stackoverflow.com/questions/11213520/yum-crashed-with-keyboard-interrupt-error.
actions/setup-python@v4
does not supportarm64
(https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json).
See related Open issue https://github.com/actions/setup-python/issues/108.
Note: (3) and (4) are not Amazon Linux specific. Just issues experienced when building the Amazon official image based self-hosted runners.
Top comments (0)