Brew link step failing on Python dependency

running “brew update && brew install imagemagick” on a xcode: 11.3.0 build is having the following issue when installing python as a dependency of imagemagick.

This has started just recently without changes on my end, and from what I can tell, imagemagick hasn’t had any changes related to this.

I’ve gone through some of the brew python documentation, but not sure exactly what the right next step is…

==> Pouring python-3.7.6.catalina.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 Frameworks/Python.framework/Headers
Target /usr/local/Frameworks/Python.framework/Headers
is a symlink belonging to python@2. You can unlink it:
brew unlink python@2

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

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

Possible conflicting files are:
/usr/local/Frameworks/Python.framework/Headers -> /usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Headers
/usr/local/Frameworks/Python.framework/Python -> /usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Python
/usr/local/Frameworks/Python.framework/Resources -> /usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Resources
/usr/local/Frameworks/Python.framework/Versions/Current -> /usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Versions/Current
==> /usr/local/Cellar/python/3.7.6/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.6/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.6/bin/python3 -s setup.py --no-user-cfg install
==> Caveats
Python has been installed as
/usr/local/bin/python3

Unversioned symlinks python, python-config, pip etc. pointing to
python3, python3-config, pip3 etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin

If you need Homebrew’s Python 2.7 run
brew install python@2

You can install Python packages with
pip3 install
They will install into the site-package directory
/usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

1 Like

Could you add some backticks to your post, to make it readable?

```
your console output here
```

Thanks! :+1:

I’m additionally encountering this error on a mojave image (xcode 10.2.3)

==> Installing imagemagick dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.6_1.mojave.bottl
==> Downloading from https://akamai.bintray.com/64/643d627c2b4fc03a3286c397d2992
######################################################################## 100.0%
==> Pouring python-3.7.6_1.mojave.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 Frameworks/Python.framework/Headers
Target /usr/local/Frameworks/Python.framework/Headers is a symlink belonging to python@2. You can unlink it:
  brew unlink python@2

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

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

Possible conflicting files are:
/usr/local/Frameworks/Python.framework/Headers -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Headers
/usr/local/Frameworks/Python.framework/Python -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Python
/usr/local/Frameworks/Python.framework/Resources -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Resources
/usr/local/Frameworks/Python.framework/Versions/Current -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/Current
==> /usr/local/Cellar/python/3.7.6_1/bin/python3 -s setup.py --no-user-cfg insta
==> /usr/local/Cellar/python/3.7.6_1/bin/python3 -s setup.py --no-user-cfg insta
==> /usr/local/Cellar/python/3.7.6_1/bin/python3 -s setup.py --no-user-cfg insta
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

after other dependencies are correctly installed, the process will end with the following line

Exited with code exit status 1
CircleCI received exit code 1

which kills the build.

This is a long shot, but could this have to do with python2 reaching EOL in 2020? There’s a long discussion in the homebrew discourse about this:

Any updates on it?

Are you looking for help on your own problem? If so, post the details - perhaps readers would need more information than what is in the original post.

hello,

i’ve the same problem with the same output, how i get my deployment running ?

I’ve received the answer from support, and it works.

This appears to be a regression in the latest version of Homebrew itself as disabling the Homebrew updater appears to allow ImageMagick to install correctly.

Please try disabling the automatic updater by following the guide located here: Disable Homebrew Automatic Updater

Even Travis CI is failing for me - https://travis-ci.org/ashishb/dotfiles
So, this is not Circle CI specific - https://travis-ci.org/ashishb/dotfiles/jobs/634627308