The following instructions will guide to install sparx and EMAN2 to your home directory.
Preparation work for Mac OS
Mac OS X do not come with the C++ compiler and GNU make installed. You need to install them by yourself. Please Install Xcode which is the collection of development tools (g++, make, etc).
Visit the page http://developer.apple.com/tools/download/, download and install xcode. It will require registration as Mac developer!
Download and unpack EMAN2/sparx source code
The source code can be found at web page http://ncmi.bcm.edu/ncmi/software/counter_222/software_86, although you might need fill out a registration form.
After you get the file (eman2.nightly.source.tar.gz), move it to home directory and unpack it:
tar -zxvf eman2.nightly.source.tar.gz
which would create directory EMAN2 under your home directory,
NOTE: on multi-CPU machines all make commands can be replaced to make -j 4 where 4 is the number of CPUs available. It will significantly reduce the time of compilation.
Install some 3rd party libraries(fftw, etc.)
EMAN2 employs the following 3rd party libraries: fftw, gsl, boost, hdf5, jpeglib (optional), tifflib (optional).
install fftw
cd $HOME/EMAN2/src
curl http://www.fftw.org/fftw-3.1.2.tar.gz -o fftw-3.1.2.tar.gz
tar -zxvf fftw-3.1.2.tar.gz
cd fftw-3.1.2
# enable the single precission version and shared library
./configure --enable-float --enable-shared
make
sudo make install
the last step will ask you for your password.
install gsl (GNU Scientific library)
cd $HOME/EMAN2/src
curl ftp://ftp.gnu.org/gnu/gsl/gsl-1.10.tar.gz -o gsl-1.10.tar.gz
tar -zxvf gsl-1.10.tar.gz
cd gsl-1.10
./configure
make
sudo make install
install boost
Note: (1) the latest version is 1.35 but it seems to has some problem on Mac, we will stick to 1.34_1 for now.
- (2) to install boost library, boost-jam must be installed first
install boost-jam
cd #HOME/EMAN2/src
curl http://internap.dl.sourceforge.net/sourceforge/boost/boost-jam-3.1.16.tgz -o boost-jam-3.1.16.tgz
tar -zxvf boost-jam-3.1.16.tgz
cd boost-jam-3.1.16
./build.sh
sudo cp bin.macosxx86/bjam /usr/bin/
install boost-1.34-1
cd $HOME/EMAN2/src
curl http://superb-west.dl.sourceforge.net/sourceforge/boost/boost_1_34_1.tar.gz -o boost_1_34_1.tar.gz
tar -zxvf boost_1_34_1.tar.gz
cd boost_1_34_1
sudo bjam --toolset=darwin install
- The installation of boost could be very time-consuming.
install hdf5
cd $HOME/EMAN2/src
curl ftp://ftp.hdfgroup.org/HDF5/current16/src/hdf5-1.6.7.tar.gz -o hdf5-1.6.7.tar.gz
tar -zxvf hdf5-1.6.7.tar.gz
cd hdf5-1.6.7
./configure --prefix=/usr/local
make
sudo make install
install numpy
cd $HOME/EMAN2/src
curl http://superb-west.dl.sourceforge.net/sourceforge/numpy/numpy-1.0.4.tar.gz -o numpy-1.0.4.tar.gz
tar -zxvf numpy-1.0.4.tar.gz
cd numpy-1.0.4
sudo python setup.py install
install berkeley db (Mac OS X only)
cd $HOME/EMAN2/src
curl http://download.oracle.com/berkeley-db/db-4.7.25.NC.tar.gz -o db-4.7.25.NC.tar.gz
tar -zxvf db-4.7.25.NC.tar.gz
cd db-4.7.25.NC/build_unix
../dist/configure --prefix=/usr
make
make install
install setuptools python module
cd $HOME/EMAN2/src
curl http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz#md5=0e9bbe1466f3ee29588cc09d3211a010 -o setuptools-0.6c8.tar.gz
tar -zxvf setuptools-0.6c8.tar.gz
cd setuptools-0.6c8
sudo python setup.py install
install python module for berkeley db
cd $HOME/EMAN2/src
curl http://pypi.python.org/packages/source/b/bsddb3/bsddb3-4.7.2.tar.gz#md5=77b23d137eaa1153327ef93b10ddcfc1 -o bsddb3-4.7.2.tar.gz
tar -zxvf bsddb3-4.7.2.tar.gz
cd bsddb3-4.7.2
sudo python setup.py install
about jpeglib and tifflib
it is not recommended to install jpeglib and tifflib, since they conflict with system libraries
install cmake
- cmake is used to compile eman2, to install it, got www.cmake.org, there are binary distributions for mac os x, linux and windows.
install EMAN2
compilation
cd $HOME/EMAN2/src/build
cmake ../eman2
ccmake ../eman2
an interface will popup in which you have to setup environmental variables, set the following (replace your user name for xxx):
ENABLE_BOOST : ON # not necessary ?? PAP
ENABLE_JPEG : OFF
ENABLE_TIFF : OFF
BOOST_INCLUDE_PATH : /usr/local/include/boost-1_34_1
GLU_LIBRARY : /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib
GL_LIBRARY : /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
JPEG_LIBRARY : /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Resources/libJPEG.dylib
- press 'c' to configure, then set up:
BOOST_LIBRARY : /usr/local/lib/libboost_python-1_34_1.dylib
- press 'c' to configure, then press 'g' to generate make file and quit, then:
make
make install
- libraries should appear in directory \$HOME/EMAN2/lib/
make symbolic links (Mac OS X only)
The libraries start with "libpy" are actually python modules, unfortunately, python only load file whose extension is ".so" or ".py", thus you must make symbolic link for these files. The following script makelink.py can do it for you:
#!/usr/bin/env python
import os
from sys import stdin
from string import strip, split
line = stdin.readline()
while len(line) > 0 :
line = strip( line )
name, ext = split( line, '.' )
assert ext=="dylib"
assert name[0:5]=="libpy"
cmd = "ln -s " + line + " " + name + ".so"
os.system( cmd )
print cmd
line = stdin.readline()
- to use it, save it and copy it to \$HOME/EMAN2/lib, and type:
cd ~/EMAN2/lib
chmod +x makelink.py
ls libpy*.dylib | ./makelink.py
install IPython (Interactive Python)
cd $HOME/EMAN2/src
curl http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz -o ipython-0.9.1.tar.gz
tar -zxvf ipython-0.9.1.tar.gz
cd ipython-0.9.1
sudo python setup.py install
7. setup the environment:
- add the following lines to your bashrc file:
export PATH=$PATH:$HOME/EMAN2/bin:$HOME/EMAN2/sparx/bin
export LD_LIBRARY_PATH=$HOME/EMAN2/lib
export PYTHONPATH=$HOME/EMAN2/lib:$HOME/EMAN2/sparx/libpy
- or in cshell in .cshrc:
setenv LD_LIBRARY_PATH /Users/pawel/EMAN2/lib
setenv PYTHONPATH $HOME/EMAN2/lib:$HOMEEMAN2/sparx/libpy
set path=( $HOME/EMAN2/bin $HOME/EMAN2/sparx/bin .)
Note, for Mac OS X, you should replace LD_LIBRARY_PATH by DYLD_LIBRARY_PATH
start sparx
chmod +x $HOME/EMAN2/sparx/bin/sparx
- now you should be able to start the non-GUI sparx
install sparx with GUI (optional)
install Qt4
Qt4 is used to build sparx GUI. To install it, go to http://trolltech.com/downloads/opensource, there are a Mac versions (with extension dmg) and linux versions available for download.
install sip
sip is needed by PyQt4, to install it:
cd $HOME/EMAN2/src/
curl http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.7.7.tar.gz -o sip-4.7.7.tar.gz
tar -zxvf sip-4.7.7.tar.gz
cd sip-4.7.7
python configure.py
make
sudo make install
install PyQt4
PyQt4 is the python binding of Qt4, which is directly used by sparx, to install it
cd $HOME/EMAN2/src
curl http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.4.3.tar.gz -o PyQt-mac-gpl-4.4.3.tar.gz
tar -zxvf PyQt-mac-gpl-4.4.3.tar.gz
cd PyQt-mac-gpl-4.4.3
python configure.py # answer yes to question
make
sudo make install
install PyOpenGL
cd $HOME/EMAN2/src
curl http://superb-west.dl.sourceforge.net/sourceforge/pyopengl/PyOpenGL-3.0.0b1.tar.gz -o PyOpenGL-3.0.0b1.tar.gz
tar -zxvf PyOpenGL-3.0.0b1.tar.gz
cd PyOpenGL-3.0.0b1
sudo python setup.py install
install matplotlib
cd $HOME/EMAN2/src
curl http://superb-west.dl.sourceforge.net/sourceforge/matplotlib/matplotlib-0.91.2.tar.gz -o matplotlib-0.91.2.tar.gz
tar -zxvf matplotlib-0.91.2.tar.gz
cd matplotlib-0.91.2
python setup.py install
- sparx GUI version should work by now.
