actions / runner-images

GitHub Actions runner images
MIT License
9.58k stars 2.95k forks source link

Issue with brew #4020

Closed arttet closed 2 years ago

arttet commented 2 years ago

Description

When I use brew install cppcheck cpplint include-what-you-use, I get the error:

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.9

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

Possible conflicting files are:
/usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3

This issue has emerged recently. That command worked well one week ago.

Virtual environments affected

Image version and build link

  Environment: macos-11
  Version: 20210831.3
  Included Software: https://github.com/actions/virtual-environments/blob/macOS-11/20210831.3/images/macos/macos-11-Readme.md
  Image Release: https://github.com/actions/virtual-environments/releases/tag/macOS-11%2F20210831.3

Is it regression?

https://github.com/actions/virtual-environments/releases/tag/macOS-10.15%2F20210814.1

Expected behavior

OK

Actual behavior

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.9

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

Possible conflicting files are:
/usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3

Repro steps

  1. brew install cppcheck cpplint include-what-you-use
al-cheb commented 2 years ago

Hello, @arttet I couldn't reproduce the issue from my side. Or it failed when brew update&brew upgrade commands present(in that case you should run rm -rf /usr/local/bin/2to3 command before brew upgrade)?

macOS-10.15: image

macOS-11: image

lordgamez commented 2 years ago

I get the same issue if I want to manually install python on macos-10.15 with the command brew install python

Previously I did not need to install python as it should be present on the host machine, but today all the macos-10.15 builds started failing with the following (maybe it is connected to this issue):

-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3.5")
CMake Error at /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
  (Required is at least version "3.0")
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  extensions/script/CMakeLists.txt:37 (find_package)

-- Configuring incomplete, errors occurred!
traversaro commented 2 years ago

Example of a minimum action that reproduces the problem: https://github.com/traversaro/github-actions-brew-update-upgrade-check/actions/runs/1204436581 .

arttet commented 2 years ago

It is my simple example to reproduce the bug.

mikhailkoliada commented 2 years ago

It happens due to python3.9.6 -> python3.9.7 upgrade

mikhailkoliada commented 2 years ago

We have found the root cause of this problem. Newly-generated images will make the problem gone (as updated images include an updated python version and no conflicts will happen). We are going to fix the problem until the next python release.

fredemmott commented 2 years ago

Also saw this, appears resolved by 20210905.2 image

mikhailkoliada commented 2 years ago

All the images have been updated by now.

joshua-auchincloss commented 7 months ago

Looks like this issue regressed - the dependency chain that errs is as follows:

E.g. outputs:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/python3
Target /usr/local/bin/python3
already exists. You may want to remove it:
  rm '/usr/local/bin/python3'
larseggert commented 5 months ago

This has recently (yesterday?) started happening on the macos-13 runner. The new macos-14 works (for now?), FWIW.

FirePing32 commented 4 months ago

Still persists on macos-12 and macos-13. Resolved on macos-14. @mikhailkoliada any plans of fixing these images ?

Mukul1127 commented 4 months ago

It seems this is fixed on macos-14 because it just overwrote it

==> Installing python@3.12
==> Pouring python@3.12--3.12.2_1.arm64_sonoma.bottle.tar.gz
Warning: These files were overwritten during the `brew link` step:
/opt/homebrew/bin/2to3
/opt/homebrew/bin/idle3
/opt/homebrew/bin/pydoc3
/opt/homebrew/bin/python3
/opt/homebrew/bin/python3-config
/opt/homebrew/share/man/man1/python3.1
/opt/homebrew/lib/pkgconfig/python3-embed.pc
/opt/homebrew/lib/pkgconfig/python3.pc
/opt/homebrew/Frameworks/Python.framework/Headers
/opt/homebrew/Frameworks/Python.framework/Python
/opt/homebrew/Frameworks/Python.framework/Resources
/opt/homebrew/Frameworks/Python.framework/Versions/Current
They have been backed up to: /Users/runner/Library/Caches/Homebrew/Backup
==> /opt/homebrew/Cellar/python@3.12/3.12.2_1/bin/python3.12 -Im ensurepip
==> /opt/homebrew/Cellar/python@3.12/3.12.2_1/bin/python3.12 -Im pip install -v 
==> Summary
🍺  /opt/homebrew/Cellar/python@3.12/3.12.2_1: 3,239 files, 65.5MB
kchawla-linus commented 4 months ago

Looks like this issue regressed - the dependency chain that errs is as follows:

  • 2to3
  • idle3
  • pydoc3
  • python3 ... stopped adding rm ... past here.

E.g. outputs:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/python3
Target /usr/local/bin/python3
already exists. You may want to remove it:
  rm '/usr/local/bin/python3'

I encountered this issue as well, when running brew install imagemagick via fastlane using macos-13 runner. It tries to install `imagemagick 7.1.1-29_1 but fails when trying to pour the python bottle -

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'

Switching to the macos-14 runner somehow is installing an older version of imagemagick which skips installing python altogether.

Run brew install imagemagick
==> Downloading https://ghcr.io/v2/homebrew/core/imagemagick/manifests/7.1.1-26
==> Fetching dependencies for imagemagick: jbig2dec, libidn, openjpeg, ghostscript, highway, imath, openexr, webp, jpeg-xl, libvmaf, aom, libde265, shared-mime-info, x265, libheif, liblqr, jasper, libomp, libraw, m4 and libtool
==> Downloading https://ghcr.io/v2/homebrew/core/jbig2dec/manifests/0.20
...
🍺  /opt/homebrew/Cellar/libtool/2.4.7: 75 files, 3.8MB
==> Installing imagemagick
==> Pouring imagemagick--7.1.1-26.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/imagemagick/7.1.1-26: 809 files, 31.3MB
alteredtech commented 1 month ago

Started having this issue just two hours apart from each other. Currently only happens on macos-13 runner. No changes were made to the actions. Only change was a typo in documentation.

Successful

Current runner version: '2.317.0'
Operating System
Runner Image
  Image: macos-13
  Version: 20240609.1
  Included Software: https://github.com/actions/runner-images/blob/macos-13/20240609.1/images/macos/macos-13-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/macos-13%2F20240609.1
Installing dependencies for repo/internal-tap/toolstools: libgit2, z3, llvm, rust, mozjpeg, libxml2, libxslt and openjpeg
==> Installing repo/internal-tap/tools dependency: libgit2
==> Downloading https://ghcr.io/v2/homebrew/core/libgit2/manifests/1.7.2
Already downloaded: /Users/runner/Library/Caches/Homebrew/downloads/9671856ced457ee95383408b4c243c7f196b6f204228b11a53735a8a561e2abb--libgit2-1.7.2.bottle_manifest.json
==> Pouring libgit2--1.7.2.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/libgit2/1.7.2: 105 files, 4.5MB

Failed

Current runner version: '2.317.0'
Operating System
Runner Image
  Image: macos-13
  Version: 20240609.1
  Included Software: https://github.com/actions/runner-images/blob/macos-13/20240609.1/images/macos/macos-13-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/macos-13%2F20240609.1
Installing dependencies for repo/internal-tap/tools: python@3.12, libgit2, z3, llvm, rust, mozjpeg, libxml2, libxslt and openjpeg
==> Installing repo/internal-tap/tools dependency: python@3.12
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.12/manifests/3.12.4
Already downloaded: /Users/runner/Library/Caches/Homebrew/downloads/2970a992f26f411cf71250ce54eb24411d8b065824b51819da7085559f09ce66--python@3.12-3.12.4.bottle_manifest.json
==> Pouring python@3.12--3.12.4.ventura.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Error: The `brew link` step did not complete successfully
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
/usr/local/bin/idle3.12 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/idle3.12
/usr/local/bin/pydoc3 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/pydoc3
/usr/local/bin/pydoc3.12 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/pydoc3.12
/usr/local/bin/python3 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/python3
/usr/local/bin/python3-config -> /Library/Frameworks/Python.framework/Versions/3.12/bin/python3-config
/usr/local/bin/python3.12 -> /Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
/usr/local/bin/python3.12-config -> /Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-config
==> /usr/local/Cellar/python@3.12/3.12.4/bin/python3.12 -Im ensurepip
==> /usr/local/Cellar/python@3.12/3.12.4/bin/python3.12 -Im pip install -v --no-
==> Summary
🍺  /usr/local/Cellar/python@3.12/3.12.4: 3,277 files, 63.9MB

The only difference I have found between the 3 images is macos-12 uses homebrew 4.3.2, macos-13 uses homebrew 4.3.3, and macos-14 uses homebrew 4.3.5.

Not how that would cause it to succeed once and then fail but something I noticed.