Project

General

Profile

Install EMAN2 » History » Version 60

Amber Herold, 11/22/2013 10:25 AM

1 1 Neil Voss
h1. Install EMAN2/SPARX
2
3 53 Amber Herold
*Before you begin:*
4 55 Amber Herold
Please note that Appion 2.2, Appion 2.2-redux and any earlier releases do not include any features that require EMAN2/SPARX to be installed. Appion 3.0, the development trunk and future releases will require this software.
5
This documentation assumes you are using CentOS 6 (written as of CentOS 6.4)
6
It is best to install EMAN2/SPARX from source, to avoid conflicts with having two different versions of python on your system. Binaries of EMAN2/SPARX all come with their own python pre-installed.
7 6 Neil Voss
8
9 55 Amber Herold
h2. Install pre-requisite packages for EMAN2 compiling
10 6 Neil Voss
11 27 Neil Voss
h3. yum based packages
12
13 7 Neil Voss
* Make sure EPEL is install, if not go here: [[Download additional Software (CentOS Specific)]]
14
* Use yum to install devel libraries:
15
<pre>
16 10 Neil Voss
sudo yum install fftw-devel gsl-devel boost-python numpy \
17 12 Neil Voss
 PyQt4-devel cmake ipython hdf5-devel libtiff-devel libpng-devel \
18 8 Neil Voss
 PyOpenGL ftgl-devel db4-devel python-argparse openmpi-devel
19 1 Neil Voss
</pre>
20 27 Neil Voss
21
h3. bsddb3
22
23
Additionally you need to install the python-bsddb3 library (not available via YUM). I just use the pypi easy_installer, yum will never know.
24 26 Neil Voss
<pre>
25 1 Neil Voss
sudo easy_install bsddb3
26
</pre>
27 27 Neil Voss
28 3 Neil Voss
h2. Download the source
29
30
# To download the source code go to the link:
31
#* http://blake.bcm.edu/emanwiki/EMAN2
32 56 Amber Herold
# Click on *"Main EMAN2 Download Page"*
33 57 Amber Herold
# Click on *"Download EMAN 2.0x"*, whichever is the latest minor release of 2.0. 
34 60 Amber Herold
# Scroll down to *Source* to download the *eman2.07.source.tar.gz* 
35 3 Neil Voss
36
h2. Work with the source
37
38
# go to the directory with the source code
39
# extract the archive:
40
<pre>
41 60 Amber Herold
tar zxvf eman2.07.source.tar.gz
42 1 Neil Voss
</pre>
43 15 Neil Voss
# go into directory
44
<pre>cd EMAN2/src/build</pre>
45 19 Neil Voss
# start configure script:
46 11 Neil Voss
<pre>cmake ../eman2/</pre>
47 15 Neil Voss
#* Note: alternatively you can run @ccmake ../eman2/@ and configure all the parameters
48 18 Neil Voss
# start compiling:
49
<pre>make</pre>
50 3 Neil Voss
# install to directory:
51 23 Neil Voss
<pre>sudo make install</pre>
52
53
h2. Set environmental variables
54
55
h3. bash
56
57
<pre>sudo nano /etc/profile.d/eman2.sh</pre>
58 24 Neil Voss
59
<pre>
60
export EMAN2DIR=/usr/local/EMAN2
61
export PATH=${EMAN2DIR}/bin:${PATH}
62 23 Neil Voss
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${EMAN2DIR}/lib
63
export PYTHONPATH=${EMAN2DIR}/lib:${EMAN2DIR}/bin
64
</pre>
65 16 Neil Voss
66 51 Neil Voss
h3. c shell
67
68
<pre>sudo nano /etc/profile.d/eman2.csh</pre>
69
70
<pre>
71
setenv EMAN2DIR /usr/local/EMAN2
72
setenv PATH ${EMAN2DIR}/bin:${PATH}
73
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${EMAN2DIR}/lib
74
setenv PYTHONPATH ${EMAN2DIR}/lib:${EMAN2DIR}/bin
75
</pre>
76
77
78 50 Neil Voss
h2. Install MyMPI
79 42 Neil Voss
80
* Download source: 
81 45 Neil Voss
<pre>wget -O pydusa-1.15-sparx.tgz \
82
 'http://sparx-em.org/sparxwiki/MPI-installation?action=AttachFile&do=get&target=pydusa-1.15-sparx.tgz'</pre>
83 42 Neil Voss
* Extract:
84
<pre>tar zxvf pydusa-1.15-sparx.tgz</pre>
85
* go into directory
86
<pre>cd pydusa-1.15-sparx</pre>
87 54 Neil Voss
88
I had problems with the code finding the numpy headers:
89
90 34 Neil Voss
<pre>nano configure</pre>
91 54 Neil Voss
92
find the line:
93 1 Neil Voss
<pre>
94
elif test -d ${PY_PREFIX}/lib/python$PY_VERSION/site-packages/numpy/core/include; then
95
   PY_HEADER_NUMPY="-I${PY_PREFIX}/lib/python$PY_VERSION/site-packages/numpy/core/include"
96 54 Neil Voss
</pre>
97
and replace it with:
98
99
<pre>
100 1 Neil Voss
elif test -d ${PY_PREFIX}/lib64/python$PY_VERSION/site-packages/numpy/core/include; then
101
   PY_HEADER_NUMPY="-I${PY_PREFIX}/lib64/python$PY_VERSION/site-packages/numpy/core/include"
102 46 Neil Voss
</pre>
103
* Configure:
104
<pre>
105
setenv MPIROOT /usr/lib64/openmpi
106
setenv MPIINC /usr/include/openmpi-x86_64
107
setenv MPILIB ${MPIROOT}/lib
108
setenv MPIBIN ${MPIROOT}/bin
109 1 Neil Voss
./configure
110
</pre>
111
<pre>
112
export MPIROOT=/usr/lib64/openmpi
113
export MPIINC=/usr/include/openmpi-x86_64
114
export MPILIB=${MPIROOT}/lib
115 47 Neil Voss
export MPIBIN=${MPIROOT}/bin
116 46 Neil Voss
./configure
117
</pre>
118
* compile the source:
119
<pre>make</pre>
120
* copy the mpi.so to site-packages with a different name:
121
<pre>
122 1 Neil Voss
sudo mkdir /usr/lib64/python2.6/site-packages/mympi/
123 52 Neil Voss
sudo touch /usr/lib64/python2.6/site-packages/mympi/__init__.py
124 1 Neil Voss
sudo cp -v src/mpi.so /usr/lib64/python2.6/site-packages/mympi/mpi.so
125
</pre>
126 47 Neil Voss
* create a wrapper around the wrapper:
127 1 Neil Voss
<pre>sudo nano /usr/lib64/python2.6/site-packages/mpi.py</pre>
128
<pre>
129
import ctypes
130
mpi = ctypes.CDLL('libmpi.so.1', ctypes.RTLD_GLOBAL)
131
from mympi.mpi import *
132
</pre>
133 50 Neil Voss
This needs to be done to avoid the error:
134
<pre>
135
python: symbol lookup error: 
136
  /usr/lib64/openmpi/lib/openmpi/mca_paffinity_hwloc.so: 
137
    undefined symbol: mca_base_param_reg_int
138
</pre>
139 1 Neil Voss
140
* test 1: 
141
<pre>
142
python -c 'import mpi'
143
python -c 'import sys; from mpi import mpi_init; mpi_init(len(sys.argv), sys.argv)'
144
</pre>
145
146 50 Neil Voss
* test 2: 
147
<pre>sxisac.py start.hdf</pre>
148
(Note: start.hdf does not need to exist, if it does not exist then it should exit with file not found)
149 42 Neil Voss
150 50 Neil Voss
h2. Test to see if code works
151
152
see http://blake.bcm.edu/emanwiki/EMAN2/FAQ/EMAN2_unittest
153
154
<pre>
155
cd EMAN2/test/rt
156
./rt.py
157
</pre>
158
159
h2. Install MyMPI for MPI functions
160
161
see http://sparx-em.org/sparxwiki/MPI-installation
162
or https://www.nbcr.net/pub/wiki/index.php?title=MyMPI_Setup
163
164
This fixes this problem:
165
<pre>
166
    from mpi import mpi_init
167
ImportError: No module named mpi
168
</pre>
169
170
This module was very difficult 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.
171 34 Neil Voss
172 9 Neil Voss
h2. Documentation
173 3 Neil Voss
174 1 Neil Voss
* http://blake.bcm.edu/emanwiki/EMAN2/Install
175 2 Neil Voss
* http://blake.bcm.edu/emanwiki/EMAN2/FAQ/eman2BuildFAQ
176 31 Neil Voss
177 2 Neil Voss
______
178
179
[[Install EMAN|< Install EMAN 1]] | [[Install SPIDER|Install SPIDER >]]
180 1 Neil Voss
181
______