douglascamata / setup-docker-macos-action

A Github Action to setup Docker on macOS runners.
MIT License
29 stars 9 forks source link

Error installing QEMU with `brew`: failing to link `python` (required by `qemu` formula) #31

Closed owenthereal closed 5 months ago

owenthereal commented 5 months ago

Build link: https://github.com/pgxman/pgxman/actions/runs/8226570015/job/22524288851#step:3:269

Logs:

  ==> Installing qemu dependency: python@3.12
  ==> Downloading https://ghcr.io/v2/homebrew/core/python/3.12/manifests/3.12.2_1
  Already downloaded: /Users/runner/Library/Caches/Homebrew/downloads/db6a7027cff95a641d6d0c07e00f7b8fa26b0733b6d215c3752b745a381ebcb8--python@3.12-3.12.2_1.bottle_manifest.json
  ==> Pouring python@3.12--3.12.2_1.ventura.bottle.tar.gz
  Error: The `brew link` step did not complete successfully
  The formula built, but is not symlinked into /usr/local
  Could not symlink bin/2to3
  Target /usr/local/bin/2to3
  already exists. You may want to remove it:
    rm '/usr/local/bin/2to3'

  To force the link and overwrite all conflicting files:
    brew link --overwrite python@3.12

  To list all files that would be deleted:
    brew link --overwrite python@3.12 --dry-run

  Possible conflicting files are:
  /usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/2to3
  /usr/local/bin/2to3-3.12 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/2to3-3.12
  /usr/local/bin/idle3 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/idle3
(...)

FHachez commented 5 months ago

We are also encountering the issue and it's blocking us. My understanding is that github use a newer version of macos that already ship with python 3.12 and the version we try to install is clashing.

What's the best solution? Can we take the brute force way by adding a brew install docker docker-compose qemu -force? Or do you see a way to skip the python 3.12 installation to use the default python version?

I'm happy to make a PR but I'm not sure what's the best solution. A --force is the easiest, and it's reasonable as long as the action is always used on a fresh macos instance. But it could lead to surprises if the users also setup python or another lib themselves before calling the setup-docker-macos-action.

douglascamata commented 5 months ago

@FHachez I will take some time today to see whether other people using Homebrew are having this issue.

I personally never encountered it myself and I use macOS full time, with qemu.

This make me wonder wether it's Github that when building the Action Runner's images links the system Python into /usr/local/bin. In this case I think it's safe to override it and we can merge your PR to see how it goes.

humdrum commented 5 months ago

FYI, I encountered the same error with macos-13 too.

스크린샷 2024-03-13 오후 6 15 36
douglascamata commented 5 months ago

FYI we are trying to figure out a good way of handling this. 🚧

douglascamata commented 5 months ago

Meanwhile, I reported this as a bug to Github as it doesn't happen in all runner versions: https://github.com/actions/runner-images/issues/9510.

douglascamata commented 5 months ago

For those using this action directly from the main branch: I just merged a PR with a fix for the Python issue. Can you please test it and let me know if it works for you too? After confirmation I'll push a new release.

FHachez commented 5 months ago

Awesome, thank you, @douglascamata. It's working for us on the github actions.

humdrum commented 5 months ago

It's working for me too. Thank you. @douglascamata

GlassOfWhiskey commented 5 months ago

THis is working also with StreamFlow (see alpha-unito/streamflow#408)

douglascamata commented 5 months ago

I pushed a new v1-alpha.13 tag and updated the v1-alpha tag with the fix.

I'll leave this issue open for a week in case something else comes up as a consequence of the workaround. If nothing comes up by next Monday I will close this issue.

Thx to everyone involved and have a great week!

douglascamata commented 5 months ago

No more issues reported, so I'm closing this. Thanks again to everyone that helped in some way. 🙇