Project

General

Profile

Install EMAN2 » History » Revision 42

Revision 41 (Neil Voss, 08/14/2012 09:57 AM) → Revision 42/87 (Neil Voss, 08/14/2012 10:19 AM)

h1. Install EMAN2/SPARX 

 It is best to install EMAN2/SPARX from source, so that do not have conflicts with having two different versions of python on your system. Binaries of EMAN2/SPARX all come with their own python pre-installed. 

 This documentation assumes you are using CentOS 6 (written as of CentOS 6.2) 

 h2. Install require pre-packages for EMAN2 compiling 

 h3. yum based packages 

 * Make sure EPEL is install, if not go here: [[Download additional Software (CentOS Specific)]] 
 * Use yum to install devel libraries: 
 <pre> 
 sudo yum install fftw-devel gsl-devel boost-python numpy \ 
  PyQt4-devel cmake ipython hdf5-devel libtiff-devel libpng-devel \ 
  PyOpenGL ftgl-devel db4-devel python-argparse openmpi-devel 
 </pre> 

 h3. bsddb3 

 Additionally you need to install the python-bsddb3 library (not available via YUM). I just use the pypi easy_installer, yum will never know. 
 <pre> 
 sudo easy_install bsddb3 
 </pre> 

 h2. Download the source 

 # To download the source code go to the link: 
 #* http://blake.bcm.edu/emanwiki/EMAN2 
 # Click on *"Current stable version - direct link"* 
 # Go under the heading "Source" at bottom of page 
 # Click to download the *eman-source-2.xx.tar.gz* file (as of August 2012, 2.xx is 2.06) 

 h2. Work with the source 

 # go to the directory with the source code 
 # extract the archive: 
 <pre> 
 tar zxvf eman-source-2.06.tar.gz 
 </pre> 
 # go into directory 
 <pre>cd EMAN2/src/build</pre> 
 # start configure script: 
 <pre>cmake ../eman2/</pre> 
 #* Note: alternatively you can run @ccmake ../eman2/@ and configure all the parameters 
 # start compiling: 
 <pre>make</pre> 
 # install to directory: 
 <pre>sudo make install</pre> 

 h2. Set environmental variables 

 h3. bash 

 <pre>sudo nano /etc/profile.d/eman2.sh</pre> 

 <pre> 
 export EMAN2DIR=/usr/local/EMAN2 
 export PATH=${EMAN2DIR}/bin:${PATH} 
 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${EMAN2DIR}/lib 
 export PYTHONPATH=${EMAN2DIR}/lib:${EMAN2DIR}/bin 
 </pre> 

 h2. Test to see if code works 

 see http://blake.bcm.edu/emanwiki/EMAN2/FAQ/EMAN2_unittest 

 <pre> 
 cd EMAN2/test/rt 
 ./rt.py 
 </pre> 

 h2. Install MyMPI for SPARX MPI functions 

 see http://sparx-em.org/sparxwiki/MPI-installation 
 or https://www.nbcr.net/pub/wiki/index.php?title=MyMPI_Setup 

 This fixes this problem: 
 <pre> 
     from mpi import mpi_init 
 ImportError: No module named mpi 
 </pre> 

 This module was very difficult h3. to get working, it seems to be a poorly supported python wrapper for MPI. So, what we are going to do is compile the module, rename it, and create a wrapper. So, essentially we are creating a wrapper around the wrapper. We can only hope they switch to [http://mpi4py.scipy.org/ mpi4py] in the future. install 

 h3. Install MyMPI 

 * Download source:  
 <pre>wget 'http://sparx-em.org/sparxwiki/MPI-installation?action=AttachFile&do=get&target=pydusa-1.15-sparx.tgz'</pre> source 
 * Extract: 
 <pre>tar tar zxvf pydusa-1.15-sparx.tgz</pre> 
 * go into cd directory 
 <pre>cd pydusa-1.15-sparx</pre> 
 * setenv MPIINC /usr/include/openmpi-x86_64/ 
 * ./configure --with-mpicc=/usr/lib64/openmpi/bin/mpicc 
 ** if it fails you need to change these lines in configure 
 <pre>nano configure</pre> 
 <pre> 
 elif test -d ${PY_PREFIX}/lib/python$PY_VERSION/site-packages/numpy/core/include; then 
    PY_HEADER_NUMPY="-I${PY_PREFIX}/lib/python$PY_VERSION/site-packages/numpy/core/include" 
 </pre><pre> 
 elif test -d ${PY_PREFIX}/lib64/python$PY_VERSION/site-packages/numpy/core/include; then 
    PY_HEADER_NUMPY="-I${PY_PREFIX}/lib64/python$PY_VERSION/site-packages/numpy/core/include" 
 </pre> 
 * compile the source: make 
 <pre>make</pre> 
 * copy the mpi.so to site-packages with a different name: 
 <pre>sudo cp -v src/mpi.so /usr/lib64/python2.6/site-packages/mympi.so</pre> 
 * create a wrapper around the wrapper: 
 <pre>sudo nano /usr/lib64/python2.6/site-packages/mpi.py 

 <pre> 
 from mympi import * 

 def mpi_init(): 
   import ctypes 
   mpi = ctypes.CDLL('libmpi.so.1', ctypes.RTLD_GLOBAL) 
   f = ctypes.pythonapi.Py_GetArgcArgv 
   argc = ctypes.c_int() 
   argv = ctypes.POINTER(ctypes.c_char_p)() 
   f(ctypes.byref(argc), ctypes.byref(argv)) 
   sys.argv = mpi_init(len(sys.argv), sys.argv) 
 </pre> /usr/lib64/python2.6/site-packages/ 
 * test 1: python -c 'from mpi import mpi_init' 
 * test 2: sxisac.py start.hdf (Note: start.hdf does not need to exist) 


 h2. Documentation 

 * http://blake.bcm.edu/emanwiki/EMAN2/Install 
 * http://blake.bcm.edu/emanwiki/EMAN2/FAQ/eman2BuildFAQ 

 ______ 

 [[Install EMAN|< Install EMAN 1]] | [[Install SPIDER|Install SPIDER >]] 

 ______