Python CLI Tools Installing Inside Python Framework on macOS-12
Description
We have a GitHub Action that installs codemagic-cli-tools using the following shell command:
pip3 install codemagic-cli-tools
This is supposed to add several CLI programs to the path (installing them to usr/local/bin). We use one of them, app-store-connect, later in the action.
This script broke somewhere between 6 and 1 days ago (the last successful run was on 10/27, around 23:30 UTC, first failed run was yesterday), with the failure:
app-store-connect: command not found
After running some tests, we determined that none of the CLI tools that are supposed to be added are present in usr/local/bin. There was an update to codemagic-cli-tools on the first failed run, so we tried using the exact same version, and the error persisted.
After some more investigation, we noticed that on the last successful run, the python CLI was referenced as simply python3.10, but on the failing runs, it is referenced by the full path:
/Library/Frameworks/Python.framework/Versions/3.11/bin/python
So then we looked into the following directory:
/Library/Frameworks/Python.framework/Versions/3.11/bin
And we found the CLI tools installed there.
We tried running them from there, and got a bunch of Python errors, but that may be a problem with those tools.
However, it seems like the latest macos runner that upgraded Python from 3.10.8 to 3.11 resulted in something about the paths getting messed up for Python.
Last successful run: https://github.com/movehq/hq-driver-ios/actions/runs/3341642377/jobs/5533052139 First failing run: https://github.com/movehq/hq-driver-ios/actions/runs/3370254410/jobs/5590925123
Platforms affected
- [ ] Azure DevOps
- [X] GitHub Actions - Standard Runners
- [ ] GitHub Actions - Larger Runners
Runner images affected
- [ ] Ubuntu 18.04
- [ ] Ubuntu 20.04
- [ ] Ubuntu 22.04
- [ ] macOS 10.15
- [ ] macOS 11
- [X] macOS 12
- [ ] Windows Server 2019
- [ ] Windows Server 2022
Image version and build link
https://github.com/actions/runner-images/blob/macOS-12/20221027.1/images/macos/macos-12-Readme.md
Is it regression?
https://github.com/actions/runner-images/blob/macOS-12/20221018.2/images/macos/macos-12-Readme.md
Expected behavior
CLI tools installed by this Python library should be in usr/local/bin, so they are in the shell path.
Actual behavior
CLI tools are installed to /Library/Frameworks/Python.framework/Versions/3.11/bin, and not in the shell path.
Repro steps
Run the following script in a GitHub Action:
pip3 install codemagic-cli-tools
which app-store-connect
I'm seeing the same thing with pip3 install conan. I can work around it by setting the following step prior to any steps that use it:
- name: Add Python bin to PATH
run: echo "/Library/Frameworks/Python.framework/Versions/Current/bin" >> $GITHUB_PATH
One of my CI jobs is scheduled to run every day. Last time it worked, the runner image was 20221018.2. First failure had runner image 20221027.1.
I bet this will fix the image: https://github.com/actions/runner-images/commit/c7958d79a7076013bd48cb7b6cc19ece210d2127
I held off on a PR since the Contribution guide said macOS external contributions aren't supported, but let me know if you want me to make one.
Hi @aetherealtech and @ssrobins thank you for reporting and contributing, we will check it and get back to you.
Please give top priority to this, we need to issue a patch on iOS ASAP
Please give top priority to this, we need to issue a patch on iOS ASAP
Our recommendation is to use setup-python action - https://github.com/actions/setup-python
Thanks @al-cheb team sends you a hug! To the github team: I opened a ticket because we spent some minutes figuring this out and we would like us and everyone else on the platform to get reimbursed for this. Specially because MacOS minutes have a 10x multiplier.
Deployed