After some frustrating experience with MacPorts regarding failed builts and outdated versions I decided to setup my python development environment anew and do some things differently. Basically I followed Joern Hees’ fantastic blog post to switch away from my old environment with MacPorts and Conda and onto a fresh install using homebrew and virtualenv and pyenv.
A Word to the Wise
set up some taps and update brew
brew tap homebrew/science # a lot of cool formulae for scientific tools
brew tap homebrew/python # numpy, scipy, matplotlib, ...
The taps mostly don’t exist anymore or are deprecated, doesn’t matter too much though, since most of the packages have been migrated to the homebrew core tap.
pip install virtualenv
Of course virtualenv does exist, however there are some compatibility issues regarding the macos graphics backend and the usage of tensorflow; therefore one can either change the graphics backend to TgAgg or use pyenv instead.
An Additional Tip
Switching environments can be a hassle and therefore I suggest implementing a little bash function into your .profile file like this:
sc() {
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
source ~/venv/science/bin/activate
}
To be honest, I am quite happy with how this solution worked out and sadly the hardest part was to get rid of all the old stuff I had installed previously, but I won’t get into detail here; luckily with this new solution that won’t a problem.