Homebrew-core: python3 -> python migration

Created on 2 Mar 2018  Â·  8Comments  Â·  Source: Homebrew/homebrew-core

hello!

After upgrade brew, I have python3 as the default version of python in env on my mac.

Prior to this, the version by default was system python2.

Will not something be broken after the update from system utilities?
hight sierra.
thx!

Most helpful comment

Heads up if anyone else run into problems.
Without me realising brew partially auto-migrated python3 when installing another package. Python3 disappeared from my path, and brew would only link python2.7 instead of python3.x.

The solution was
brew upgrade python

All 8 comments

According to the brew homepage at https://docs.brew.sh/Homebrew-and-Python python is meant to always be system python, and homebrew formulae should install as either python2 or python3 (depending on version). Seems like a bug if brew python is suddenly aliasing over system python. Further, python2 now appears to install as keg only by default, which is a fairly drastic change (if intentional).

This was announced in January: https://brew.sh/2018/01/19/homebrew-1.5.0/

All of the docs will take a little time to get fully caught up.

Heads up if anyone else run into problems.
Without me realising brew partially auto-migrated python3 when installing another package. Python3 disappeared from my path, and brew would only link python2.7 instead of python3.x.

The solution was
brew upgrade python

The issue should be reopened.
brew aliases python to python3.x. That breaks many python programs on my system.
brew link -v python
among other links:
ln -s ../Cellar/python/3.6.4_3/bin/python python

@foldager it's intentional. Anything that breaks needs to be switched to a versioned shebang like #!/usr/bin/env python2.7

(or #!/usr/bin/python if system Python is sufficient for your needs)

Oh, ok. That is quite a drastic change. I didn't get that from the link you send. My solution was to rm /usr/local/bin/python. I guess it is time update some shebangs to #!/usr/bin/env python2.7.

Welcome to the future! :-)

I am also experiencing the same breakage as @foldager; I don't care about the shebang stuff mentioned by @ilovezfs though (it's all well and good). What broke is that doing brew install <unrelated package> caused python3 — which is versioned — to be removed from /usr/local/bin. brew upgrade then uninstalls Python 2, so an additional brew install python@2 is required.

While I might be understanding of the python symlink changing, I am less understanding of a brew install command essentially rewriting the available packages I have. The auto migration could have been a lot smoother.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yuna9 picture yuna9  Â·  4Comments

tejasmanohar picture tejasmanohar  Â·  3Comments

ghostbar picture ghostbar  Â·  4Comments

bantl23 picture bantl23  Â·  3Comments

Steffen911 picture Steffen911  Â·  3Comments