Homebrew updating major Python version breaks a lot of things on my system

I’m sure this is coming up more but I would prefer homebrew not automatically upgrading major python versions on my system.

The latest upgrade has moved me from python3.7 to python3.8 and now everything that depends on 3.7 does not work anymore.

I tried brew install python@3.7 but that does not fix this either.

Is there any easy way I can downgrade and/or pin this?

OK. I got my pipenv to work again by:

brew uninstall pipenv
rm /usr/loca/bin/pipenv
brew install pipenv

But still this is problematic because in the Pipfile we have the Python version specified and we’d like to not be forced to move.

Homebrew is an evergreen package manager, you’ll always have the latest version that we can provide. If you want a more stable target something like https://github.com/pyenv/pyenv is a better solution then using “whatever homebrew calls latest”

I don’t understand it. python@3.7 exists, why can’t I have it?

You can, but it might not exist next week if all homebrew formula work with 3.8

I installed it but I can’t brew switch to it.

What’s keeping you from using pyenv ? This would allow different projects to have its own Python version along with package dependencies.

1 Like

There really needs to be a warning. Thje problem is Homebrew just updates python indiscriminatively, and as it stands right now PyCharm users should uninstall homebrew (which is a cohort that includes almost all professional python users*, because when homebrew currently upgrades to a version of python which is currently unsupported, without asking and holy shi** it actually makes glib dependent on it, which makes it incredibly messy to downgrade.

No need to uninstall Homebrew. Professional Python developers would use some kind of virtual environment (such as pyenv) because each project would have its own dependencies (which often includes a particular Python version). I use Pycharm with Homebrew just fine, thanks to pyenv.

That said, Homebrew uses Python mostly as a runtime since a lot of open source applications depends on it. Regardless whether those apps were written in Python or not.

The problem is. virtualenv/wrapper and pipenv tend to use symlinks, to existing FS pythons and libraries. Im not sure about pyenv, that one doesnt turn up in the wild so often. My understanding is you can bludgeon pycharm to support it, but its by no means a default in there.

Regardless of the case. homebrew breaks virtualenvs, that much isn’t in question. So some sort of warning and an option to back out when python is going to be updated would be really useful, otherwise its just too unproductive to keep homebrew around if your on the clients dime. (Also, it would appear the python env setup tooling in pycharm uses a version of setuptools that isnt supported in 3.9, so python3.9 is a no go for now.

Perhaps not uninstall, but absolutely PyCharm users should not be using any homebrew feature that might sneakily trigger a 3.9 upgrade till PyCharm updates its tooling. or stuff just breaks hard

Did u try brew unlink python@3.8 and link to original 3.7 ?

I’m not sure but from memory I remember that never really being a working strategy.

My developers are recommended not to use homebrew to manage their Python installations.

The strategy is brew install pyenv and then pin it. Pyenv updates are rarely necessary and if homebrew updates that, that also messes with things.