Install EMAN2 » History » Version 43
Neil Voss, 08/14/2012 10:19 AM
1 | 1 | Neil Voss | h1. Install EMAN2/SPARX |
---|---|---|---|
2 | |||
3 | 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. |
||
4 | 2 | Neil Voss | |
5 | 6 | Neil Voss | This documentation assumes you are using CentOS 6 (written as of CentOS 6.2) |
6 | |||
7 | h2. Install require pre-packages for EMAN2 compiling |
||
8 | |||
9 | 27 | Neil Voss | h3. yum based packages |
10 | |||
11 | 7 | Neil Voss | * Make sure EPEL is install, if not go here: [[Download additional Software (CentOS Specific)]] |
12 | * Use yum to install devel libraries: |
||
13 | <pre> |
||
14 | 10 | Neil Voss | sudo yum install fftw-devel gsl-devel boost-python numpy \ |
15 | 12 | Neil Voss | PyQt4-devel cmake ipython hdf5-devel libtiff-devel libpng-devel \ |
16 | 8 | Neil Voss | PyOpenGL ftgl-devel db4-devel python-argparse openmpi-devel |
17 | 1 | Neil Voss | </pre> |
18 | 27 | Neil Voss | |
19 | h3. bsddb3 |
||
20 | |||
21 | Additionally you need to install the python-bsddb3 library (not available via YUM). I just use the pypi easy_installer, yum will never know. |
||
22 | 26 | Neil Voss | <pre> |
23 | 1 | Neil Voss | sudo easy_install bsddb3 |
24 | </pre> |
||
25 | 27 | Neil Voss | |
26 | 3 | Neil Voss | h2. Download the source |
27 | |||
28 | # To download the source code go to the link: |
||
29 | #* http://blake.bcm.edu/emanwiki/EMAN2 |
||
30 | 17 | Neil Voss | # Click on *"Current stable version - direct link"* |
31 | 3 | Neil Voss | # Go under the heading "Source" at bottom of page |
32 | # Click to download the *eman-source-2.xx.tar.gz* file (as of August 2012, 2.xx is 2.06) |
||
33 | |||
34 | h2. Work with the source |
||
35 | |||
36 | # go to the directory with the source code |
||
37 | # extract the archive: |
||
38 | <pre> |
||
39 | 4 | Neil Voss | tar zxvf eman-source-2.06.tar.gz |
40 | 1 | Neil Voss | </pre> |
41 | 15 | Neil Voss | # go into directory |
42 | <pre>cd EMAN2/src/build</pre> |
||
43 | 19 | Neil Voss | # start configure script: |
44 | 11 | Neil Voss | <pre>cmake ../eman2/</pre> |
45 | 15 | Neil Voss | #* Note: alternatively you can run @ccmake ../eman2/@ and configure all the parameters |
46 | 18 | Neil Voss | # start compiling: |
47 | <pre>make</pre> |
||
48 | 3 | Neil Voss | # install to directory: |
49 | 23 | Neil Voss | <pre>sudo make install</pre> |
50 | |||
51 | h2. Set environmental variables |
||
52 | |||
53 | h3. bash |
||
54 | |||
55 | <pre>sudo nano /etc/profile.d/eman2.sh</pre> |
||
56 | 24 | Neil Voss | |
57 | <pre> |
||
58 | export EMAN2DIR=/usr/local/EMAN2 |
||
59 | export PATH=${EMAN2DIR}/bin:${PATH} |
||
60 | 23 | Neil Voss | export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${EMAN2DIR}/lib |
61 | export PYTHONPATH=${EMAN2DIR}/lib:${EMAN2DIR}/bin |
||
62 | </pre> |
||
63 | 16 | Neil Voss | |
64 | h2. Test to see if code works |
||
65 | |||
66 | see http://blake.bcm.edu/emanwiki/EMAN2/FAQ/EMAN2_unittest |
||
67 | |||
68 | <pre> |
||
69 | cd EMAN2/test/rt |
||
70 | ./rt.py |
||
71 | 3 | Neil Voss | </pre> |
72 | 1 | Neil Voss | |
73 | 42 | Neil Voss | h2. Install MyMPI for MPI functions |
74 | 31 | Neil Voss | |
75 | see http://sparx-em.org/sparxwiki/MPI-installation |
||
76 | 32 | Neil Voss | or https://www.nbcr.net/pub/wiki/index.php?title=MyMPI_Setup |
77 | 31 | Neil Voss | |
78 | 33 | Neil Voss | This fixes this problem: |
79 | <pre> |
||
80 | from mpi import mpi_init |
||
81 | ImportError: No module named mpi |
||
82 | </pre> |
||
83 | |||
84 | 42 | Neil Voss | 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. |
85 | 1 | Neil Voss | |
86 | 42 | Neil Voss | h3. Install MyMPI |
87 | |||
88 | * Download source: |
||
89 | <pre>wget 'http://sparx-em.org/sparxwiki/MPI-installation?action=AttachFile&do=get&target=pydusa-1.15-sparx.tgz'</pre> |
||
90 | * Extract: |
||
91 | <pre>tar zxvf pydusa-1.15-sparx.tgz</pre> |
||
92 | * go into directory |
||
93 | <pre>cd pydusa-1.15-sparx</pre> |
||
94 | 35 | Neil Voss | * setenv MPIINC /usr/include/openmpi-x86_64/ |
95 | 34 | Neil Voss | * ./configure --with-mpicc=/usr/lib64/openmpi/bin/mpicc |
96 | ** if it fails you need to change these lines in configure |
||
97 | <pre>nano configure</pre> |
||
98 | 1 | Neil Voss | <pre> |
99 | elif test -d ${PY_PREFIX}/lib/python$PY_VERSION/site-packages/numpy/core/include; then |
||
100 | PY_HEADER_NUMPY="-I${PY_PREFIX}/lib/python$PY_VERSION/site-packages/numpy/core/include" |
||
101 | </pre><pre> |
||
102 | elif test -d ${PY_PREFIX}/lib64/python$PY_VERSION/site-packages/numpy/core/include; then |
||
103 | PY_HEADER_NUMPY="-I${PY_PREFIX}/lib64/python$PY_VERSION/site-packages/numpy/core/include" |
||
104 | </pre> |
||
105 | 42 | Neil Voss | * compile the source: |
106 | <pre>make</pre> |
||
107 | * copy the mpi.so to site-packages with a different name: |
||
108 | <pre>sudo cp -v src/mpi.so /usr/lib64/python2.6/site-packages/mympi.so</pre> |
||
109 | * create a wrapper around the wrapper: |
||
110 | 43 | Neil Voss | <pre>sudo nano /usr/lib64/python2.6/site-packages/mpi.py</pre> |
111 | 42 | Neil Voss | |
112 | <pre> |
||
113 | from mympi import * |
||
114 | |||
115 | def mpi_init(): |
||
116 | import ctypes |
||
117 | mpi = ctypes.CDLL('libmpi.so.1', ctypes.RTLD_GLOBAL) |
||
118 | f = ctypes.pythonapi.Py_GetArgcArgv |
||
119 | argc = ctypes.c_int() |
||
120 | argv = ctypes.POINTER(ctypes.c_char_p)() |
||
121 | f(ctypes.byref(argc), ctypes.byref(argv)) |
||
122 | sys.argv = mpi_init(len(sys.argv), sys.argv) |
||
123 | </pre> |
||
124 | 41 | Neil Voss | * test 1: python -c 'from mpi import mpi_init' |
125 | * test 2: sxisac.py start.hdf (Note: start.hdf does not need to exist) |
||
126 | |||
127 | 34 | Neil Voss | |
128 | 9 | Neil Voss | h2. Documentation |
129 | 3 | Neil Voss | |
130 | 1 | Neil Voss | * http://blake.bcm.edu/emanwiki/EMAN2/Install |
131 | 2 | Neil Voss | * http://blake.bcm.edu/emanwiki/EMAN2/FAQ/eman2BuildFAQ |
132 | 31 | Neil Voss | |
133 | 2 | Neil Voss | ______ |
134 | |||
135 | [[Install EMAN|< Install EMAN 1]] | [[Install SPIDER|Install SPIDER >]] |
||
136 | 1 | Neil Voss | |
137 | ______ |