I upgraded my older MacBook Pro to a new retina MacBook Pro.
For a couple of generations I used to migrate everything over to a new machine with the migration assistant or in target mode.
This time I used the chance to start over new since the system was clogged with a number of environments that became problematic (Ruby and Python installs, which weren’t always easy under rechten Mac OS versions).
Also wanted to replace legacy Macports installs with homebrew.
Pawel Lachowicz shares his how-to for installing Python on Mavericks:
In this how-to I will generally follow Pawel’s list of packages to install. But doing so I will note errors, mitigations and changes I encountered during install.
I also installed R which for some functions relies on TCL/TK. Which is outdated on Mavericks, do R brings it’s own TCL/TK install package.
Since is installs to /usr/local it can potentially interfere with homebrew (according to brew doctor).
So I would rather recommend to remove the TCL/TK install that comes with package R and use the homebrew TCL/TK libs.
So far I have not tried homebrew R.
To be able to uninstall and to install different versions of Python I followed this recommendation on hackercodex.com.
First, install homebrew:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew install python --with-brewed-openssl
brew install python3 --with-brewed-openssl
virtualenv allows to install Python packages into different virtual environment. In turn this allows i.e. testing different versions of packages or different package sets.
Python packages can be installed with the older setuptools or the newer pip.
See here at hackercodex.com for advantages/disadvantages.
pip allows uninstall, so I chose pip.
pip install virtualenv
To make proper use of virtualenv one needs to create and activate an environmen, i.e.:
A virtualenv can be deactivated like this:
Then, go on installing the packages recommended by Pawel:
- pip install mpmath
- pip install numpy
The next package, scipy requires a Fortran compiler.
I did not have one installed. On my fresh OS X Mavericks install homebrew was the easiest solution. But is also possible to install Fortran from the Mac OS X 10.7 (Lion) installer, see Jonathan Goldsmith’s post at github.
brew install gfortran
- pip install scipy
- brew install pkg-config
- brew install freetype
- brew install libpng
- brew install ffmpeg
- pip install matplotlib
Trying to install matplotlib yields another error:
With the version change from matplotlib 184.108.40.206 to 2.5.1 the header directory structure was changed (see here). This is known, but seems to not have been fixed yet in the pip package.
This solution from David at stackoverflow solved the problem:
sudo ln -s /usr/X11/include/freetype2/freetype /usr/X11/include/
Again, continue installing packages:
- brew install zeromq
- pip install pyzmq
- Already installed in site-packages with homebrew python 2.7.6: pip install Tornado
- pip install readline
- pip install azure
- Skipped: pip install curses
- pip install cython
- pip install jinja2
- pip install pexpect
- pip install pygments
- pip install pymongo
- pip install sphinx
- Skipped, since already installed by brew via dependency: pip install sqlite3
- pip install wx
- Skipped, since already installed by brew via dependency: pip install zmq
- pip install sympy
- pip install patsy
- pip install scikit_learn
- Note: statsmodels requires pandas, so install pandas first.
pip install pandas
- pip install statsmodels
- pip install ipython