Differences between revisions 9 and 48 (spanning 39 versions)
Revision 9 as of 2015-03-06 03:29:58
Size: 19169
Editor: MichaelBell
Comment:
Revision 48 as of 2016-10-25 17:12:22
Size: 15175
Editor: SteveLudtke
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
The following install was successful (barring yet unseen bugs!) on Mountain Lion. If you wish to skip the fun of compiling by hand, you can follow the instructions below. Homebrew is a package management system for Mac. It is under active development and has strict policies to protect the user from damage via software. They also seek to protect users from themselves by avoiding sudo commands as much as possible. It is recommended that you do NOT install homebrew alongside other package managers such as macports/fink.

The following install was successful on OS X 10.8 (Mountain Lion) and OS X 10.10 (Yosemite) and 10.11 (El Capitan). If for any reason this doesn't work for you, I recommend refreshing your terminal (1st) and restarting your computer (2nd) since many of the packages downloaded might require sourcing. If neither solve your specific problem, please send an e-mail to a member of the lab and we'll try to address it as soon as possible. Also, it may be necessary to turn off SIP (System Integrity Protection) before proceeding when installing on El Capitan. To do this, reboot your machine while holding [CMD]+[R], open a terminal from the utilities menu at the top of the screen, type "csrutil disable", hit enter, type reboot, and hit enter to restart with SIP disabled.

Additionally, a known problem of using pure homebrew is that Qt windows seem to possess abnormally large buttons. A way around this is to install Qt/PyQt from source.
Line 9: Line 13:
Homebrew is a package management system for Mac. It is under active development and has strict policies to protect the user from damage via software. They also seek to protect users from themselves by avoiding sudo commands as much as possible. It is recommended that you do NOT install homebrew alongside other package managers such as macports/fink. It seems to do just fine on its own.
Line 17: Line 19:
To make sure everything is , run: To make sure everything is up to date, run:

{{{
brew update
}}}

To make sure everything is configured correctly, run the following command, addressing any warnings or errors before proceeding. Most of the warnings can be ignored, but for the smoothest install, it is better to address them sooner rather than later.
Line 23: Line 31:
Add the following to your shell's 'rc' file to source homebrew programs ahead of the system's default versions: Additionally, add the following to your shell's 'rc' file to source homebrew programs ahead of the system's default versions:
Line 29: Line 37:
If you find you have already completed these instructions but are upgrading from OS X 10.8, 10.9, or 10.10, you will need to reinstall all homebrew packages or start from scratch. Luckily, there is an easy way to do the former:

{{{
brew list | xargs brew reinstall -v
}}}

This should reinstall all packages in their current versions.
Line 35: Line 51:
If you have upgraded your system from a previous version of Mac OS X and/or a previous version of Xcode, make sure previous versions have been "cleanly" removed.

{{{
sudo /Developer/Library/uninstall-devtools --mode=all
}}}

Installing Xcode is a two step process. First, install Xcode from the Mac App Store. Second, open Xcode, and go to "Preferences" then "Downloads". Select "Command Line Tools" and click the "Install" button to the right. Wait for this to complete.

== CVS/GIT ==

CVS and GIT are version control systems. You can install them as follows:

{{{
brew install git cvs mercurial
You'll also need the command line tools, which you can install with:

{{{
xcode-select --install
}}}

== CMake ==

CMake is a family of tools designed to build, test and package software. It is used to generate the Makefiles for compiling EMAN2. We install the homebrew version as follows:

{{{
brew install cmake
}}}

== Qt4 ==

Qt is a graphics library for cross-platform user interfaces.

{{{
brew install qt --with-developer --with-docs --HEAD
}}}

== Boost ==

Boost is a set of useful, standardized libraries for C++. It is used to generate the Python-C++ interface in EMAN2. Homebrew comes with two 'boost' packages, and we'll need both to generate the libraries required for compiling EMAN2:

{{{
brew install boost --with-python
brew install boost-python
}}}

To install with MPI support, simply run the following commands instead:

{{{
brew install boost --with-mpi --with-python
brew install boost-python
}}}

== GSL ==

The GNU Scientific Library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting.

{{{
brew install gsl
}}}

A personal concern is that there is no option to '--enable-float'; however, I have not run into any problems with this yet.

== FFTW3 ==

FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). The most recent version is available from homebrew as follows:

{{{
brew install fftw
}}}

== Berkeley DB (5.3.28) ==

The Oracle Berkeley DB family of open source, embeddable databases provides developers with fast, reliable, local persistence with zero administration. EMAN2 uses Berkeley DB as a mechanism for local storage of project metadata.

Oracle has made their most recent version very VERY proprietary. To install BDB, you need an account on the following website at which you can download BDB 5.3.28.

http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index-082944.html

Once there, download "Berkeley_DB_5.3.28.tar.gz," then enter the following commands where you placed the download (preferably your source code directory).
{{{
tar -xzf db-5.3.28
cd db-5.3.28/build_unix
../../dist/configure
make
sudo make install
}}}

If you encounter errors during this process, I suggest trying the following:

{{{
cd db-5.3.28
cd src/dbinc
curl -O https://raw.githubusercontent.com/narkoleptik/os-x-berkeleydb-patch/master/atomic.patch
patch atomic.h < atomic.patch
cd ../../build_unix
../dist/configure
make
sudo make install
}}}

== Freetype and libPNG ==

On Mac OS X 10.8 and later, X11 and Freetype are no longer included by default. Even if you are using an earlier Mac OS X, I recommend installing your own Freetype. Homebrew offers the most recent version of freetype, but we'll need to explicitly include it in our configuration step later on.

{{{
brew install freetype
}}}


The PNG (Portal Network Graphics) format provides lossless-compressed image support. Although homebrew installs libpng as a dependency for freetype, it can be installed independently using the following command

{{{
brew install libpng
}}}


== FTGL ==

FTGL is a free, open source library to enable developers to use arbitrary fonts in their OpenGL applications. We can install it as follows:

{{{
brew install ftgl
}}}

== HDF5 ==

HDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data.

{{{
brew tap homebrew/science
brew install hdf5
}}}

== SIP ==

Python's SIP (not to be confused with Mac OS X's SIP) is a tool that makes it very easy to create Python bindings for C and C++ libraries. It was originally developed to create PyQt, the Python bindings for the Qt toolkit, but can be used to create bindings for any C or C++ library.

{{{
brew install sip
}}}

== PyQt4 ==

PyQt4 provides Python bindings for Qt4. This software underlies every EMAN2 GUI application.

{{{
brew install pyqt
}}}

= Required Python Modules =

== PIP ==

Pip is a package manager for python. To install it, use the system's own "easy_install" program

{{{
easy_install pip
}}}

== Numpy ==

Numpy is an array manipulation package for python. To install, run

{{{
pip install numpy --upgrade
}}}

== bsddb3 ==

bsddb3 provides Python bindings for the Berkeley DB API.

Having previously defined the BERKELEYDB_DIR environment variable, we can install bsddb3 with pip very easily:

{{{
pip install bsddb3
}}}

== PyOpenGL ==

PyOpenGL provides Python bindings for OpenGL. There is a pip package for it, available here, along with an acceleration package for optimization of certain graphics routines.

{{{
pip install PyOpenGL PyOpenGL-accelerate
}}}

== IPython ==

IPython provides a rich toolkit to help you make the most out of using Python interactively. EMAN2 uses iPython for the "e2.py" interactive interpreter environment.

{{{
pip install ipython
}}}

== Matplotlib ==

Matplotlib is a python 2D and 3D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments. It can be installed with the following line:

{{{
pip install matplotlib
}}}

For examples and inspiration, see: [[http://matplotlib.org/gallery.html]]

== Readline ==

{{{
pip install gnureadline
}}}

= Optional (Recommended) Packages =

== Readline ==

Readline facilitates command history parsing in python.

{{{
brew install readline
}}}
 
== JPEG ==

Jpeg is a library for writing JPEG image files.

{{{
brew install jpeg
}}}

== TIFF ==

Libtiff is a library for reading and writing TIFF image files.

{{{
brew install libtiff
}}}

== For EMAN2 Developers ==

If you spend a lot of time developing EMAN2, you will likely want these packages

{{{
brew install git cvs doxygen gnu-indent cscope
Line 52: Line 281:

== GCC/LLVM ==

To compile EMAN2's C++ code, we need to download a compiler. Here we install the homebrew versions of gcc and llvm, which are more up-to-date than those available on Mac by default.

{{{
brew install gcc
brew install llvm --with-clang --with-asan
}}}

== CMake ==

CMake is a family of tools designed to build, test and package software. It is used to generate the Makefiles for compiling EMAN2. We install the homebrew version as follows:

{{{
brew install cmake
}}}

== OpenGL ==

{{{
brew install glew glfw3
}}}

== Qt4 ==

Qt is a graphics library for cross-platform user interfaces.

{{{
brew install qt
}}}

If you need to incorporate additional qt features, check the output of

{{{
brew options qt
}}}

to see what else you can include.

== Boost ==

Boost is a set of useful, standardized libraries for C++. It is used to generate the Python-C++ interface in EMAN2. Homebrew comes with two 'boost' packages, and we'll need both to generate the libraries required for compiling EMAN2:

{{{
brew install boost --with-mpi # or leave out the mpi option
brew install boost-build boost-python
}}}

== GSL ==

The GNU Scientific Library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting.

{{{
brew install gsl
}}}

A personal concern is that there is no option to '--enable-float'; however, I have not run into any problems with this yet.

== FFTW3 ==

FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). The most recent version is available from homebrew as follows:

{{{
brew install fftw
}}}

== Berkeley DB (5.3.28) ==

The Oracle Berkeley DB family of open source, embeddable databases provides developers with fast, reliable, local persistence with zero administration. EMAN2 uses Berkeley DB as a mechanism for local storage of project metadata.

Oracle has made their most recent version very VERY proprietary. You need an account on their website to download the package, and you need a license to use 6.0.1. Instead, we can use homebrew, but we need to get a previous version since homebrew defaults to 6.0.1 (as of March, 2015). I managed to find instructions on Stack Overflow ([[https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula]]) that explain how to go about this and have reproduced them below:

{{{
brew tap homebrew/boneyard
brew versions berkeley-db # Copy the command after '5.3.28'
cd $( brew --prefix )
git checkout fdc17de /usr/local/Library/Formula/berkeley-db.rb
cd ${HOME}
}}}

Now we can install berkeley-db just as we would any other package.

{{{
brew install berkeley-db
}}}

Finally, add the following to your shell's 'rc' file to enable bsddb3 to know where berkeley-db is located:

{{{
export BERKELEYDB_DIR=/usr/local/BerkeleyDB.5.3
}}}

At this point, I suggest that you refresh your shell.

== Freetype ==

On Mac OS X 10.8 and later, X11 and Freetype are no longer included by default. Even if you are using an earlier Mac OS X, I recommend installing your own Freetype. Homebrew offers the most recent version of freetype, but we'll need to explicitly include it in our configuration step later on.

{{{
brew install freetype
}}}

== FTGL ==

FTGL is a free, open source library to enable developers to use arbitrary fonts in their OpenGL applications. We can install it as follows:

{{{
brew install ftgl
}}}

== PNG ==

The PNG (Portal Network Graphics) format provides lossless-compressed image support. Mac OS X 10.7 Lion ships with libpng 1.5, in which some deprecated features in the PNG API were removed. EMAN2 is being updated to use these new methods. For now, use libpng 1.2 if you are compiling on 10.7.

{{{
brew install libpng
}}}

== HDF5 ==

HDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data.

{{{
brew install hdf5
}}}

=== JPEG ===

Library for writing JPEG image files. Though optional, it's very easy to install this package:

{{{
brew install jpeg
}}}

=== TIFF ===

Library for reading and writing TIFF image files. Install TIFF as follows:

{{{
brew install libtiff
}}}

=== Readline ===

We can easily install 'readline' to parse command history in python as follows:

{{{
brew install readline
}}}

= Required Python Modules =

Here we opt to use the homebrew version of python over the default install built against the system.

{{{
brew install python
}}}

This sets up a separate site-packages directory, installs 'pip' (a package management solution for Python), and allows us to 'build' our python library from scratch, incorporating only the components we want/need.

For further project specificity, we could opt for a virtual environment, which can be created after installing:

{{{
pip install vrtualenv
}}}

An explanation of the innerworkings of python virtual environments are beyond the scope of this document; however, you can find more information here: [[http://docs.python-guide.org/en/latest/dev/virtualenvs/]]


== sip (4.12) ==

SIP is a tool that makes it very easy to create Python bindings for C and C++ libraries. It was originally developed to create PyQt, the Python bindings for the Qt toolkit, but can be used to create bindings for any C or C++ library.

{{{
brew install sip
}}}

== PyQt4 (4.8) ==

PyQt4 provides Python bindings for Qt4.

{{{
brew install pyqt
}}}

== bsddb3 (5.3) ==

bsddb3 provides Python bindings for the Berkeley DB API.

Having previously defined the BERKELEYDB_DIR environment variable, we can install bsddb3 with pip very easily:

{{{
pip install bsddb3
}}}

== PyOpenGL (3.0) ==

PyOpenGL provides Python bindings for OpenGL. There is a pip package for it, available here:

{{{
pip install PyOpenGL
}}}

For the sake of optimization, pip also possesses an acceleration package that you can install in addition:

{{{
pip install PyOpenGL-accelerate
}}}

== iPython (0.10) ==

IPython provides a rich toolkit to help you make the most out of using Python interactively. EMAN2 uses iPython for the "e2.py" interactive interpreter environment.

{{{
pip install ipython
}}}

For more details about ipython and its many growing features, see: [[http://ipython.org/]]

If you're interested in any of the recent developments in reproducible research and web/cloud-based python programming, I suggest using the following line to install ipython

{{{
pip install "ipython[all]"
}}}

and checking out the 'Jupyter' project online: [[http://jupyter.org/]]

== Matplotlib ==

Matplotlib is a python 2D and 3D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments. It can be installed with the following line:

{{{
pip install matplotlib
}}}

For examples and inspiration, see: [[http://matplotlib.org/gallery.html]]

== Readline ==

Homebrew has a version of readline; however, so does python. We install it here, too, for good measure.

{{{
pip install gnureadline
}}}
Line 310: Line 294:
= Download EMAN2 =

First, obtain the EMAN2 source either via a stable source release, the nightly source release, or using CVS (if you have access permissions; a CVS tutorial is beyond the scope of this document).

== For the from-source-officnato ==

Download EMAN2 from the NCMI: [[http://ncmi.bcm.tmc.edu/ncmi/software/software_details?selected_software=counter_222]]

== For EMAN2 Developer ==

Next, check out eman2 from CVS:

1. Get account on blake and be cleared to access CVS

2. Set up CVS variables on .bashrc file:

{{{
export CVSROOT=username@blake.bcm.edu:/usr/local/CVS/CVS
export CVS_RSH=ssh
}}}

3. Make 'src' directory wherever you want the source code to be

{{{
mkdir ~/src
}}}

4. Inside src, make 'build' directory

{{{
cd ~/src && mkdir build
}}}

5. Inside src, download the source code

{{{
cd ~/src && cvs co eman2
}}}
= The QUICK version =

{{{
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update && brew doctor
brew install qt --with-developer --with-docs --HEAD
brew install cmake boost boost-python ftgl freetype readline sip pyqt
brew tap homebrew/science && brew install hdf5 jpeg libtiff fftw gsl
brew install git cvs doxygen gnu-indent cscope
brew linkapps && brew cleanup && brew doctor
sudo easy_install pip
sudo -H pip install “ipython[all]” matplotlib spicy numpy gnureadline —upgrade
sudo -H pip install PyOpenGL PyOpenGL-accelerate --upgrade
}}}

Download Berkeley DB 5.3.28.tar.gz (instructions above)

{{{
tar -xf db-5.3.28
cd db-5.3.28
cd src/dbinc
curl -O https://raw.githubusercontent.com/narkoleptik/os-x-berkeleydb-patch/master/atomic.patch
patch atomic.h < atomic.patch
cd ../../build_unix
../dist/configure
make
sudo make install
sudo -H pip install bsddb3 --upgrade
}}}

= Get EMAN2 source code =

EMAN2 is now hosted on [[www.github.org|GitHub]]. Here is a direct link to dowload the source. Just hit the "clone or download" button:

[[https://github.com/cryoem/eman2]]
Line 363: Line 343:
 BOOST_INCLUDE_PATH /usr/local/include
 BOOST_LIBRARY /usr/local/lib/libboost_python.dylib
 CMAKE_OSX_ARCHITECTURES
 CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
 CMAKE_VERBOSE_MAKEFILE OFF
 EMAN_INSTALL_PREFIX /Users/jmbell/src/EMAN2/eman2
 ENABLE_AUTODOC OFF
 ENABLE_BOUNDS_CHECKING OFF
 ENABLE_DEBUG OFF
 ENABLE_EMAN_CUDA OFF
 ENABLE_FFTW2 OFF
 ENABLE_FFTW3 ON
 ENABLE_FFTW_PLAN_CACHING ON
 ENABLE_FTGL ON
 ENABLE_HDF5 ON
 ENABLE_HDFIOCACHE OFF
 ENABLE_IOCACHE OFF
 ENABLE_JPEG ON
 ENABLE_LEOPARD OFF
 ENABLE_MEMDEBUG OFF
 ENABLE_MEMDEBUG2 OFF
 ENABLE_MOUNTAIN_LION ON
 ENABLE_NATIVE_FFT OFF
 ENABLE_NFFT2 OFF
 ENABLE_OPENGL ON
 ENABLE_OPTPP OFF
 ENABLE_PNG ON
 ENABLE_PROFILE OFF
 ENABLE_RT ON
 ENABLE_SPARX_CUDA OFF
 ENABLE_TIFF ON
 ENABLE_V4L2 OFF
 ENABLE_WINDOWS_VC OFF
 ENABLE_X86_64 ON
 FFTW3_INCLUDE_PATH /usr/local/include
 FFTW3_LIBRARY /usr/local/lib/libfftw3f.dylib
 FREETYPE_INCLUDE_PATH /usr/local/include/freetype2
 FREETYPE_LIBRARY /usr/local/lib/libfreetype.dylib
 FTGL_INCLUDE_PATH /usr/local/include
 FTGL_LIBRARY /usr/local/lib/libftgl.dylib
 GL_INCLUDE_PATH /usr/local/include
 GL_LIBRARY /usr/local/lib/libgsl.dylib
 GSL_CBLAS_INCLUDE_PATH /usr/local/include
 GSL_CBLAS_LIBRARY /usr/local/lib/libgslcblas.dylib
 GSL_INCLUDE_PATH /usr/local/include
 GSL_LIBRARY /usr/local/lib/libgsl.dylib
 HDF5_INCLUDE_PATH /usr/local/include
 HDF5_LIBRARY /usr/local/lib/libhdf5.dylib
 JPEG_INCLUDE_PATH /usr/local/include
 JPEG_LIBRARY /usr/local/lib/libjpeg.dylib
 NUMPY_INCLUDE_PATH /usr/local/lib/python2.7/site-packages/numpy/core/include
 PNG_INCLUDE_PATH /usr/local/include
 PNG_LIBRARY /usr/local/lib/libpng.dylib
 PYTHON_INCLUDE_PATH /usr/local/Frameworks/Python.framework/Headers
 PYTHON_LIBRARY /usr/local/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
 TIFF_INCLUDE_PATH /usr/local/include
 TIFF_LIBRARY /usr/local/lib/libtiff.dylib
 ZLIB_LIBRARY /usr/lib/libz.dylib
}}}

= Build EMAN2 =
BOOST_INCLUDE_PATH /usr/local/include
 BOOST_LIBRARY /usr/local/lib/libboost_python.dylib
 CMAKE_BUILD_TYPE
 CMAKE_OSX_ARCHITECTURES
 CMAKE_OSX_DEPLOYMENT_TARGET
 CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf
 CMAKE_VERBOSE_MAKEFILE OFF
 EMAN_INSTALL_PREFIX /Users/jmbell/EMAN2
 ENABLE_AUTODOC OFF
 ENABLE_BOUNDS_CHECKING OFF
 ENABLE_DEBUG OFF
 ENABLE_EMAN_CUDA OFF
 ENABLE_FFTW2 OFF
 ENABLE_FFTW3 ON
 ENABLE_FFTW_PLAN_CACHING ON
 ENABLE_FFT_CACHING OFF
 ENABLE_FTGL ON
 ENABLE_HDF5 ON
 ENABLE_IOCACHE OFF
 ENABLE_JPEG ON
 ENABLE_MEMDEBUG OFF
 ENABLE_MEMDEBUG2 OFF
 ENABLE_NATIVE_FFT OFF
 ENABLE_NFFT2 OFF
 ENABLE_OPENGL ON
 ENABLE_OPTIMIZE_MACHINE ON
 ENABLE_OPTIMIZE_MOUNTAIN_LION OFF
 ENABLE_OPTIMIZE_WINDOWS_VC OFF
 ENABLE_OPTIMIZE_X86_64 OFF
 ENABLE_OPTPP OFF
 ENABLE_PNG ON
 ENABLE_PROFILE OFF
 ENABLE_RT ON
 ENABLE_SPARX_CUDA OFF
 ENABLE_TIFF ON
 ENABLE_V4L2 OFF
 FFTW3_INCLUDE_PATH /usr/local/include
 FFTW3_LIBRARY /usr/local/lib/libfftw3f.dylib
 FREETYPE_INCLUDE_PATH /usr/local/include/freetype2
 FREETYPE_LIBRARY /usr/local/lib/libfreetype.dylib
 FTGL_INCLUDE_PATH /usr/local/include
 FTGL_LIBRARY /usr/local/lib/libftgl.dylib
 GSL_CBLAS_INCLUDE_PATH /usr/local/include
 GSL_CBLAS_LIBRARY /usr/local/lib/libgslcblas.dylib
 GSL_INCLUDE_PATH /usr/local/include
 GSL_LIBRARY /usr/local/lib/libgsl.dylib
 HDF5_INCLUDE_PATH /usr/local/include
 HDF5_LIBRARY /usr/local/lib/libhdf5.dylib
 JPEG_INCLUDE_PATH /Library/Frameworks/UnixImageIO.framework/Headers
 JPEG_LIBRARY /usr/local/lib/libjpeg.dylib
 NUMPY_INCLUDE_PATH /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/l
 PNG_INCLUDE_PATH /Library/Frameworks/UnixImageIO.framework/Headers
 PNG_LIBRARY /usr/local/lib/libpng.dylib
 PYTHON_INCLUDE_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf
 PYTHON_LIBRARY /usr/lib/libpython2.7.dylib
 TIFF_INCLUDE_PATH /Library/Frameworks/UnixImageIO.framework/Headers
 TIFF_LIBRARY /usr/local/lib/libtiff.dylib
 ZLIB_LIBRARY /usr/lib/libz.dylib
}}}

= Build EMAN2 =
Line 430: Line 410:
make -j24 && make install -j24 make -j16 && make install
Line 440: Line 420:
export PYTHONPATH=$PYTHONPATH:$EMAN2DIR/lib   
}}}

This should do it. If the building process goes through without errors, the basic tests to see whether EMAN2 is actually installed properly, are
export PYTHONPATH=$PYTHONPATH:$EMAN2DIR/lib:$EMAN2DIR/bin
}}}

Once you refresh your shell by calling the shell in the terminal or by restarting your computer, everything should work properly. If the building process goes through without errors, the basic tests to see whether EMAN2 is actually installed properly, are
Line 446: Line 426:
Line 447: Line 428:
Line 450: Line 432:

## Developers (More for you!)

{{{
brew install doxygen
brew install gnu-indent
}}}

Compiling EMAN2 on Mac OS X with Homebrew

Homebrew is a package management system for Mac. It is under active development and has strict policies to protect the user from damage via software. They also seek to protect users from themselves by avoiding sudo commands as much as possible. It is recommended that you do NOT install homebrew alongside other package managers such as macports/fink.

The following install was successful on OS X 10.8 (Mountain Lion) and OS X 10.10 (Yosemite) and 10.11 (El Capitan). If for any reason this doesn't work for you, I recommend refreshing your terminal (1st) and restarting your computer (2nd) since many of the packages downloaded might require sourcing. If neither solve your specific problem, please send an e-mail to a member of the lab and we'll try to address it as soon as possible. Also, it may be necessary to turn off SIP (System Integrity Protection) before proceeding when installing on El Capitan. To do this, reboot your machine while holding [CMD]+[R], open a terminal from the utilities menu at the top of the screen, type "csrutil disable", hit enter, type reboot, and hit enter to restart with SIP disabled.

Additionally, a known problem of using pure homebrew is that Qt windows seem to possess abnormally large buttons. A way around this is to install Qt/PyQt from source.

Install homebrew

To install homebrew, simply paste the following line into your favorite Mac terminal emulator:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

To make sure everything is up to date, run:

brew update

To make sure everything is configured correctly, run the following command, addressing any warnings or errors before proceeding. Most of the warnings can be ignored, but for the smoothest install, it is better to address them sooner rather than later.

brew doctor

Additionally, add the following to your shell's 'rc' file to source homebrew programs ahead of the system's default versions:

export PATH=/usr/local/bin:$PATH

If you find you have already completed these instructions but are upgrading from OS X 10.8, 10.9, or 10.10, you will need to reinstall all homebrew packages or start from scratch. Luckily, there is an easy way to do the former:

brew list | xargs brew reinstall -v

This should reinstall all packages in their current versions.

Required Packages

Xcode

Starting with Mac OS X 10.7 and Xcode 4.3, the developer tools are distributed through the Mac App Store instead of an installer package.

You'll also need the command line tools, which you can install with:

xcode-select --install

CMake

CMake is a family of tools designed to build, test and package software. It is used to generate the Makefiles for compiling EMAN2. We install the homebrew version as follows:

brew install cmake

Qt4

Qt is a graphics library for cross-platform user interfaces.

brew install qt --with-developer --with-docs --HEAD

Boost

Boost is a set of useful, standardized libraries for C++. It is used to generate the Python-C++ interface in EMAN2. Homebrew comes with two 'boost' packages, and we'll need both to generate the libraries required for compiling EMAN2:

brew install boost --with-python
brew install boost-python

To install with MPI support, simply run the following commands instead:

brew install boost --with-mpi --with-python
brew install boost-python

GSL

The GNU Scientific Library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting.

brew install gsl

A personal concern is that there is no option to '--enable-float'; however, I have not run into any problems with this yet.

FFTW3

FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). The most recent version is available from homebrew as follows:

brew install fftw

Berkeley DB (5.3.28)

The Oracle Berkeley DB family of open source, embeddable databases provides developers with fast, reliable, local persistence with zero administration. EMAN2 uses Berkeley DB as a mechanism for local storage of project metadata.

Oracle has made their most recent version very VERY proprietary. To install BDB, you need an account on the following website at which you can download BDB 5.3.28.

http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index-082944.html

Once there, download "Berkeley_DB_5.3.28.tar.gz," then enter the following commands where you placed the download (preferably your source code directory).

tar -xzf db-5.3.28
cd db-5.3.28/build_unix
../../dist/configure
make
sudo make install

If you encounter errors during this process, I suggest trying the following:

cd db-5.3.28
cd src/dbinc
curl -O https://raw.githubusercontent.com/narkoleptik/os-x-berkeleydb-patch/master/atomic.patch
patch atomic.h < atomic.patch
cd ../../build_unix
../dist/configure
make
sudo make install

Freetype and libPNG

On Mac OS X 10.8 and later, X11 and Freetype are no longer included by default. Even if you are using an earlier Mac OS X, I recommend installing your own Freetype. Homebrew offers the most recent version of freetype, but we'll need to explicitly include it in our configuration step later on.

brew install freetype

The PNG (Portal Network Graphics) format provides lossless-compressed image support. Although homebrew installs libpng as a dependency for freetype, it can be installed independently using the following command

brew install libpng

FTGL

FTGL is a free, open source library to enable developers to use arbitrary fonts in their OpenGL applications. We can install it as follows:

brew install ftgl

HDF5

HDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data.

brew tap homebrew/science
brew install hdf5

SIP

Python's SIP (not to be confused with Mac OS X's SIP) is a tool that makes it very easy to create Python bindings for C and C++ libraries. It was originally developed to create PyQt, the Python bindings for the Qt toolkit, but can be used to create bindings for any C or C++ library.

brew install sip

PyQt4

PyQt4 provides Python bindings for Qt4. This software underlies every EMAN2 GUI application.

brew install pyqt

Required Python Modules

PIP

Pip is a package manager for python. To install it, use the system's own "easy_install" program

easy_install pip

Numpy

Numpy is an array manipulation package for python. To install, run

pip install numpy --upgrade

bsddb3

bsddb3 provides Python bindings for the Berkeley DB API.

Having previously defined the BERKELEYDB_DIR environment variable, we can install bsddb3 with pip very easily:

pip install bsddb3

PyOpenGL

PyOpenGL provides Python bindings for OpenGL. There is a pip package for it, available here, along with an acceleration package for optimization of certain graphics routines.

pip install PyOpenGL PyOpenGL-accelerate

IPython

IPython provides a rich toolkit to help you make the most out of using Python interactively. EMAN2 uses iPython for the "e2.py" interactive interpreter environment.

pip install ipython

Matplotlib

Matplotlib is a python 2D and 3D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments. It can be installed with the following line:

pip install matplotlib

For examples and inspiration, see: http://matplotlib.org/gallery.html

Readline

pip install gnureadline

Optional (Recommended) Packages

Readline

Readline facilitates command history parsing in python.

brew install readline

JPEG

Jpeg is a library for writing JPEG image files.

brew install jpeg

TIFF

Libtiff is a library for reading and writing TIFF image files.

brew install libtiff

For EMAN2 Developers

If you spend a lot of time developing EMAN2, you will likely want these packages

brew install git cvs doxygen gnu-indent cscope

Excellent documentation for GIT is available at: https://www.atlassian.com/git/

Cleaning up

Cleaning things up and ensuring that everything has been installed properly, run:

brew linkapps
brew cleanup
brew doctor

Most warnings observed when running 'brew doctor' are harmless, especially if you don't use homebrew extensively. Unless problems arise later on, we recommend ignoring them.

The QUICK version

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update && brew doctor
brew install qt --with-developer --with-docs --HEAD
brew install cmake boost boost-python ftgl freetype readline sip pyqt
brew tap homebrew/science && brew install hdf5 jpeg libtiff fftw gsl
brew install git cvs doxygen gnu-indent cscope
brew linkapps && brew cleanup && brew doctor
sudo easy_install pip
sudo -H pip install “ipython[all]” matplotlib spicy numpy gnureadline —upgrade
sudo -H pip install PyOpenGL PyOpenGL-accelerate --upgrade

Download Berkeley DB 5.3.28.tar.gz (instructions above)

tar -xf db-5.3.28
cd db-5.3.28
cd src/dbinc
curl -O https://raw.githubusercontent.com/narkoleptik/os-x-berkeleydb-patch/master/atomic.patch
patch atomic.h < atomic.patch
cd ../../build_unix
../dist/configure
make
sudo make install
sudo -H pip install bsddb3 --upgrade

Get EMAN2 source code

EMAN2 is now hosted on GitHub. Here is a direct link to dowload the source. Just hit the "clone or download" button:

https://github.com/cryoem/eman2

Configure EMAN2

1. Go to 'build' and type

ccmake ../eman2

2. Link all libraries properly.

When using Homebrew, this phase takes a little more care to get right. I suggest comparing your screen to the one I've pasted below (using OS X 10.8):

BOOST_INCLUDE_PATH               /usr/local/include
 BOOST_LIBRARY                    /usr/local/lib/libboost_python.dylib
 CMAKE_BUILD_TYPE
 CMAKE_OSX_ARCHITECTURES
 CMAKE_OSX_DEPLOYMENT_TARGET
 CMAKE_OSX_SYSROOT                /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf
 CMAKE_VERBOSE_MAKEFILE           OFF
 EMAN_INSTALL_PREFIX              /Users/jmbell/EMAN2
 ENABLE_AUTODOC                   OFF
 ENABLE_BOUNDS_CHECKING           OFF
 ENABLE_DEBUG                     OFF
 ENABLE_EMAN_CUDA                 OFF
 ENABLE_FFTW2                     OFF
 ENABLE_FFTW3                     ON
 ENABLE_FFTW_PLAN_CACHING         ON
 ENABLE_FFT_CACHING               OFF
 ENABLE_FTGL                      ON
 ENABLE_HDF5                      ON
 ENABLE_IOCACHE                   OFF
 ENABLE_JPEG                      ON
 ENABLE_MEMDEBUG                  OFF
 ENABLE_MEMDEBUG2                 OFF
 ENABLE_NATIVE_FFT                OFF
 ENABLE_NFFT2                     OFF
 ENABLE_OPENGL                    ON
 ENABLE_OPTIMIZE_MACHINE          ON
 ENABLE_OPTIMIZE_MOUNTAIN_LION    OFF
 ENABLE_OPTIMIZE_WINDOWS_VC       OFF
 ENABLE_OPTIMIZE_X86_64           OFF
 ENABLE_OPTPP                     OFF
 ENABLE_PNG                       ON
 ENABLE_PROFILE                   OFF
 ENABLE_RT                        ON
 ENABLE_SPARX_CUDA                OFF
 ENABLE_TIFF                      ON
 ENABLE_V4L2                      OFF
 FFTW3_INCLUDE_PATH               /usr/local/include
 FFTW3_LIBRARY                    /usr/local/lib/libfftw3f.dylib
 FREETYPE_INCLUDE_PATH            /usr/local/include/freetype2
 FREETYPE_LIBRARY                 /usr/local/lib/libfreetype.dylib
 FTGL_INCLUDE_PATH                /usr/local/include
 FTGL_LIBRARY                     /usr/local/lib/libftgl.dylib
 GSL_CBLAS_INCLUDE_PATH           /usr/local/include
 GSL_CBLAS_LIBRARY                /usr/local/lib/libgslcblas.dylib
 GSL_INCLUDE_PATH                 /usr/local/include
 GSL_LIBRARY                      /usr/local/lib/libgsl.dylib
 HDF5_INCLUDE_PATH                /usr/local/include
 HDF5_LIBRARY                     /usr/local/lib/libhdf5.dylib
 JPEG_INCLUDE_PATH                /Library/Frameworks/UnixImageIO.framework/Headers
 JPEG_LIBRARY                     /usr/local/lib/libjpeg.dylib
 NUMPY_INCLUDE_PATH               /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/l
 PNG_INCLUDE_PATH                 /Library/Frameworks/UnixImageIO.framework/Headers
 PNG_LIBRARY                      /usr/local/lib/libpng.dylib
 PYTHON_INCLUDE_PATH              /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf
 PYTHON_LIBRARY                   /usr/lib/libpython2.7.dylib
 TIFF_INCLUDE_PATH                /Library/Frameworks/UnixImageIO.framework/Headers
 TIFF_LIBRARY                     /usr/local/lib/libtiff.dylib
 ZLIB_LIBRARY                     /usr/lib/libz.dylib

Build EMAN2

Once you're happy with the links, press 'c' to configure and then 'g' to generate the makefile.

8. Still inside build type:

make -j16 && make install

9. Add the EMAN2 folder (and the examples folder therein) to your PATH via the .bashrc file

export EMAN2DIR=${HOME}/username/EMAN2                                                      
export PATH=$EMAN2DIR/bin:$PATH                                                             
export PATH=$EMAN2DIR/examples:$PATH                                                        
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EMAN2DIR/lib                                       
export PYTHONPATH=$PYTHONPATH:$EMAN2DIR/lib:$EMAN2DIR/bin                                              

Once you refresh your shell by calling the shell in the terminal or by restarting your computer, everything should work properly. If the building process goes through without errors, the basic tests to see whether EMAN2 is actually installed properly, are

10. A. Run e2speedtest.py from the command line

10. B. Run e2.py from the command line

10. C. Run e2display.py from the command line (assuming you're not on a cluster)

If everything went well, the above should run without failure and you can begin using EMAN2. If not, please double check that you've followed all instructions. If you have, feel free to post to the EMAN2 google group for assistance.

EMAN2/BREW_EMAN2_MAC_OS_X (last edited 2016-10-25 17:12:22 by SteveLudtke)