Installing EMAN2.2 on OSX from source with Anaconda

These instructions worked for me on Sierra (10.12). I expect they would also work on versions back several years, but cannot guarantee it.

This approach uses a Python distribution called Anaconda for all of the messy dependencies EMAN2 requires, including the Python interpreter itself. In addition, this means that if you want to use EMAN2 from Python with other Python libraries, you have a rich Anaconda environment where you can install any additional packages you like. Anaconda is cross-platform and we have found it to be a MUCH better choice than Mac-specific package managers like MacPorts.

PLEASE report any problems or update the page!

  1. Completely remove any previous eman2 source folders, and check out a fresh copy of the source from GitHub:

    git clone https://github.com/cryoem/eman2.git
  2. Install current Python2.x Anaconda from https://www.continuum.io/downloads (remember EMAN is Python2 not Python3).

    • Download the command-line installer, not the graphical installer, since this gives you a choice of where to put the installed folder.
    • Install Anaconda to $HOME/anaconda2
    • If you use a different location, you will need to update that in all of the subsequent instructions.
  3. XCode is required!
    • If you can successfully run 'g++ --version' from the command line, you should be all set and can skip to the next step.
    • XCode is free and available from the App Store. It includes the command-line C++ compiler for the Mac.
    • The first time you ever try and use the C++ compiler from the command-line it will complain if you have not run the XCode GUI, since it requires a click-through user agreement.
    • You may need to download additional tools from within XCode to get the command-line compiler working. See: http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/

  4. configure account to use this anaconda. I have a "useconda2" alias which does this (I just reset the entire PATH to avoid building up redundancies):
    useconda2='export PYTHONPATH=$HOME/EMAN2/lib:$HOME/EMAN2/bin; export EMAN2DIR=$HOME/EMAN2; export PATH=.:$HOME/anaconda2/bin:$HOME/EMAN2/bin:$HOME/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Developer/usr/bin:/Applications/Chimera.app/Contents/MacOS'
  5. Install other necessary Anaconda modules. This includes specific versions for a few. I don't recall how many of these were already installed and how many I had to do. Note that some need a specific version, eg:
    conda install qt=4 pyqt=4
    and a couple are from other channels, eg:
    conda install -c conda-forge boost boost-cpp fftw
    conda install -c jmbell ftgl
    The rest:
    conda install bsddb freetype gsl hdf5 ipython jpeg libpng libtiff matplotlib numpy=1.11 pyopengl scikit-learn scipy theano tk cmake
  6. Once all of this is done, all you have to do is get your CMake configuration to point at all of the right files. CMake should find everything automatically with 3 exceptions, as long as you put a directory called anaconda2 in your home directory. Replace $HOME below with your actual home directory:
    PYTHON_INCLUDE_PATH=$HOME/anaconda2/include/python2.7
    PYTHON_LIBRARY=$HOME/anaconda2/lib/libpython2.7.dylib
    ZLIB_LIBRARY=$HOME/anaconda2/lib/libz.dylib

Once this was done (it really didn't take very long to do), everything works for me, including the GUI. While I haven't tested absolutely everything, I did go through a lot of the tutorial and everything seemed fine.

Troubleshooting