Use Homebrew to install pyenv and pyenv-virtualenv. Then use those to install pythons and collections of packages. You'll have stable development environments.
Ran into this myself. Starting using `pyenv` instead. Never looked back. Allows you to maintain multiple versions of python outside brew's control and the system's.<p><a href="https://github.com/pyenv/pyenv" rel="nofollow">https://github.com/pyenv/pyenv</a><p>What's nice is you can find analog programs for a lot of different languages and platforms including<p><pre><code> Node: https://github.com/ekalinin/nodeenv
Ruby: https://github.com/rbenv/rbenv
Terraform: https://github.com/tfutils/tfenv</code></pre>
Article author here. I think my biggest complaint is that there’s no disclaimer on the box [1]. Homebrew folks <i>know</i> about these problems, but they don’t warn users that their virtual environments will be obliterated. If Homebrew explained that these problems can happen, and that developers might want to use a different source for installing Python interpreters, my ire would be lessened considerably.<p>[1] <a href="https://docs.brew.sh/Homebrew-and-Python.html" rel="nofollow">https://docs.brew.sh/Homebrew-and-Python.html</a>
MacPorts is installing Python just fine here, fwiw. There's a package for each Python 3.x version so you can have whatever random versions you need installed. They can be used in virtualenvs easily and they don't break when you have to install an update for a 3.x.y release.
I know this is frustrating, and I expect it affects more than just Python developers, but I think the author sums it up pretty well here:<p>> Homebrew’s Python is not for you. It exists to serve Homebrew, or more accurately, Homebrew’s other formulae. The primary purpose of Homebrew’s Python formula is to enable other Python-dependent Homebrew packages to work.<p>If you want to develop Python (likely Ruby/ PHP/ whatever), you are best keeping your dev environment separate from the interpreters installed for the purpose of running apps managed by Home-brew (or apt/ rpm/ etc).
A postgres update seriously fucked up my work Ruby install as well. We were using an old version and homebrew updated openssl on us (from 1.0.1 to 1.1 I think?) with no way of going back. (The Ruby install I was running was linked to 1.0.1, so it was not happy with having its library deleted.) I spent a month trying to figure out how to get that shit working again.<p>I really like Homebrew but its dependency management is horrible. The moment I saw that dyld "image not found" error message I didn't even have to finish reading the article to know what happened.
Homebrew Python recently had a problem with pasting in the REPL, because it uses GNU Readline and Homebrew recently updated that from 8.0 to 8.1. GNU Readline changed the default for bracketed paste mode from off in 8.0 to on in 8.1.<p>Python does not explicitly set this to what it wants (off), so if you didn't happen to have "set enable-bracketed-paste off" in your ~/.inputrc, pasting got messed up.<p>This isn't just a Homebrew thing. It also hit Arch Linux, and probably others.<p>As part of trying to figure out who to file a bug report with, I installed Apple's Python3 and I installed the Mac version of Python3 from python.org. It worked fine in the later two, so I filed the bug with Homebrew [1] (and they figured out that it is really a Python bug and they submitted a pull request upstream to have Python explicitly turn off bracketed paste).<p>The python.org Python3 was easy to install, and was the same version the Homebrew installed.<p>This raises a question. The article talks about alternate systems to manage Python installations instead of using Homebrew or using Apple's Python. But why do I want any of them? The python.org install seemed fine. Why not just use that and not have to deal with any third party Python installation managers?<p>[1] <a href="https://github.com/Homebrew/homebrew-core/issues/68193" rel="nofollow">https://github.com/Homebrew/homebrew-core/issues/68193</a>
You should give MacPorts a try...<p>MacPorts allows you to install multiple Python versions at the same time and I personally have several venvs with Python 2.7, 3.6, 3.7, 3.8, 3.9... all running without a glitch.
This was one of the pain points that made me move back to Linux on my devices, and I'm glad I did it. Homebrew is infuriating when you're used to real package managers.
I'd be perfectly happy with homebrew if it didn't auto-update all packages when installing something new. E.g. I do `brew install ffmpeg`, and as part of that it upgrades python from 3.8 to 3.9 (???), breaking imports in all my scripts. I know how to work around this, but still, surprising choice for the default behavior.
I'm a little surprised more people aren't using `anyenv`. That lets you install & update pyenv, nodenv, rbenv, etc. (though some support for certain languages is spotty) and thus get everything built/installed the way you want it.<p>Also, when using pyenv, I almost always set `env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install -v ${pylatest}` (macOS) or `env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -v ${pylatest}` (Linux). (I also set some CFLAGS, but these are personal preference.) I've had plenty of situations where not having the shared/framework build has screwed something up (and in fact that was my original reason for switching from Homebrew or package manager-installed Python years ago), and I've never had issues where the shared build screwed something up.
Can someone explain why nobody seems to use the official Python installers from python.org?<p>In my experience they work great, you can install multiple versions, and even pip3 seems to just work with them.<p>I'm not a heavy Python user, but ever since I started using the official installers it just works.
I believe I have noticed this as well with Ruby as well. All Gems work great, then, after a brew operation, I need to reinstall/rebuild against an updated Ruby. It's certainly frustrating and can bite you, especially since it is unexpected.
I have had good experiences with Conda [1], and generally use Miniconda.<p>[1] <a href="https://docs.conda.io/en/latest/" rel="nofollow">https://docs.conda.io/en/latest/</a>
I totally get that package management is Hard. However, I feel like Homebrew should be able to track what's there because it's a dependency vs what's there because the user wants it to be and act accordingly.<p>Granted, I've only lived in these tools just long enough to install what I need, so I'm sure I'm naively overlooking a lot of nuance.
Ah interesting. It appears that the reason for this difference is that Python on Homebrew is delivered as a single package for development and execution. The true intention should have been to have had Python-Homebrew to create the environment for Homebrew and Python-Dev which you can use for your development.<p>Sort of analogous to the way the JVM is distributed usually as separate packages with the JRE and the JDK.<p>I don't write very much prod-grade Python, so I just recreate the venv with my requirements.txt instead.
As someone who doesn't often use Python what is the current "best" solution for installing and managing your environment?<p>Last time I used Python on macOS and Windows I manually installed the official version from python.org and used pip and virtualenv. It wasn't too bad but it seems things have changed in the last 6 years or so? Or is this still the most flexible way to go?<p>I would be grateful for any guidance.
Homebrew and its excellent community was once indispensible on the Mac, but various pain points including this flakiness made me switch to (mini)conda for nearly everything, despite initial apprehension. There are some wrinkles and the resolver is slow, but in my hands conda is just so much more reliable than Homebrew ever was.
I gave up and just started using the OSX system copy (along w/ Google Colab), the main reason being that nearly every time there was a system update something would break and I would have to pin/unpin python@3.x
><a href="https://asdf-vm.com/" rel="nofollow">https://asdf-vm.com/</a><p>I have successfully confused people who sought meaning in 'asdf' when the string is absolutely meaningless, actually being the left-hand home keys.<p>'asdf' could be interpreted as "totally blew off that 'naming' thing".
I will almost resist the urge to truncate the title to "Python is Not for You" -- but I'd like to second the benefits of using a python version manager such as pyenv. Yes, all the versions waste an ungodly amount of space, but you probably can't/won't use Clojure instead I guess.
This all stems from the official policy of only caring about themselves and putting themselves above the users. <a href="https://docs.brew.sh/Maintainers-Avoiding-Burnout#3-prioritise-maintainers-over-users" rel="nofollow">https://docs.brew.sh/Maintainers-Avoiding-Burnout#3-prioriti...</a>