actions / setup-python

Set up your GitHub Actions workflow with a specific version of Python
MIT License
1.59k stars 505 forks source link

setup-python@v4 fails for Python 3.10.14 on Mac OS 14 (latest) ARM 64 runner #865

Closed sr-murthy closed 1 day ago

sr-murthy commented 1 month ago

Description: I use setup-python@v4 in a project CI pipeline which uses a matrix strategy including Mac OS - the action is now failing on a Mac OS 14 (latest) runner for Python 3.10.14.

Action version: v4

Platform:

Runner type:

Tools version: 3.10.14

Repro steps:
Trigger a CI job on a branch.

Expected behavior: Stage passes.

Actual behavior: Here's an excerpt of the pipeline log for the Python 3.10 setup action:


Run actions/setup-python@v4

Installed versions
  Version 3.10 was not found in the local cache
  Version 3.10 is available for downloading
  Download from "https://github.com/actions/python-versions/releases/download/3.10.14-9004012336/python-3.10.14-darwin-x64.tar.gz"
  Extract downloaded archive
  /usr/bin/tar xz -C /Users/runner/work/_temp/97020fe3-61b8-4498-b95c-27d0285812c2 -f /Users/runner/work/_temp/439d758c-170b-414d-9135-788fa7f27745
  Execute installation script
  Check if Python hostedtoolcache folder exist...
  Create Python 3.10.14 folder
  Copy Python binaries to hostedtoolcache folder
  Create additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)
  Upgrading pip...
  Error: dyld[4551]: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
    Referenced from: <09857011-94D0-3FBA-9F9D-9FCE0E7366FF> /Users/runner/hostedtoolcache/Python/3.10.14/x64/bin/python3.10
    Reason: tried: '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/System/Volumes/Preboot/
  Error: Cryptexes/OS/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file, not in dyld cache)
  ./setup.sh: line 53:  4551 Abort trap: 6           ./python -m ensurepip
  Error: The process '/bin/bash' failed with exit code 134

The pipeline failure is on a PR - the last successful run was on April 18, and I haven't made any changes to the CI YML.

Here is the relevant section of the CI YML:

name: CI

on:
  push:
    branches: 
      - main
  pull_request:
    branches: 
      - main

permissions:
  contents: read

concurrency:
  group: ${{ github.event.number || github.run_id }}
  cancel-in-progress: true

jobs:
  test:
    env:
      PYTHONDEVMODE: 1
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.10", "3.11", "3.12"]
        os: [ubuntu-latest, windows-latest, macos-latest]
        install-via: [pip]
        arch: [x64]
        include:
          - python-version: "3.11"
            os: ubuntu-latest
            install-via: script
            arch: x64
          - python-version: "3.11"
            os: windows-latest
            install-via: pip
            arch: x86

    steps:
    - uses: actions/checkout@v3

    - name: Set up Python 3.10
      uses: actions/setup-python@v4
      if: matrix.python-version != '3.10'
      with:
        python-version: "3.10"
        architecture: ${{ matrix.arch }}

    - name: Set up Python 3.11
      uses: actions/setup-python@v4
      if: matrix.python-version != '3.11'
      with:
        python-version: "3.11"
        architecture: ${{ matrix.arch }}

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
        architecture: ${{ matrix.arch }}
        allow-prereleases: false
...
...
sr-murthy commented 1 month ago

More information on the hosted runner on which this failure occurred:

Current runner version: '2.316.1'
Operating System
  macOS
  14.4.1
  23E224
Runner Image
  Image: macos-14-arm64
  Version: 20240422.3
  Included Software: https://github.com/actions/runner-images/blob/macos-14-arm64/20240422.3/images/macos/macos-14-arm64-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/macos-14-arm64%2F20240422.3
Runner Image Provisioner
  2.0.369.1+55cddbb57f254a369b6e7b3b508cebdbee5d24be
GITHUB_TOKEN Permissions
  Contents: read
  Metadata: read
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:f43a0e5ff2bd294095638e18286ca9a3d1956744)
Download action repository 'actions/setup-python@v4' (SHA:65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236)
Download action repository 'actions/cache@v4' (SHA:0c45773b623bea8c8e75f6c82b208c3cf94ea4f9)
Download action repository 'codecov/codecov-action@v4.0.1' (SHA:e0b68c6749509c5f83f984dd99a76a1c1a231044)
Complete job name: test (3.10, macos-latest, pip, x64)
HarithaVattikuti commented 1 month ago

Hello @sr-murthy Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

mayeut commented 1 month ago

duplicate of #855

sr-murthy commented 1 month ago

Thanks. I guess switching to macos-13 is a solution for now.

aparnajyothi-y commented 1 day ago

Hello @sr-murthy, The actions/setup-python repository does not support x64 packages for Python <3.11 version on macOS arm64 runners due to compatibility and build issues. The build process for Python versions less than 3.11 involves downloading the official Python sources from python.org and building them using the make tool on the oldest available version of macOS that was available when that Python version was released. This is done to ensure backward compatibility for those Python versions as mentioned in this python-versions documentation. However, this build process can run into compatibility issues on macOS arm64 runners. The arm64 architecture is used in Apple's newer Mac models that use Apple Silicon processors, which are based on a different instruction set than the x86-64 processors used in older models. Therefore, the built Python packages for versions less than 3.11 may trigger the issues like few modules missing on macOS arm64 runners. This is why the actions/setup-python repository does not support x64 packages for <Python 3.11 versions on macOS arm64 runners. For Python versions 3.11 and onwards, the actions/setup-python repository uses the official macOS universal2 Python binaries from python.org, which are compatible with both x86-64 and arm64 architectures. These can be used on macOS arm64 runners without any issues. For Arm64 platform, we use official macOS universal2 Python binaries and provide only versions which are provided by Python org. Hence we are closing this issue as x64 packages for < python 3.11 from source will not be supported by macos arm64 runners. Please feel free to reach us needed to reopen this issue for more clarifications.

sr-murthy commented 1 day ago

@aparnajyothi-y Thanks for investigating this, it's not a problem as there is a workaround of not using ARM runners for testing the pipeline with Python 3.10.