-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
333 lines (249 loc) · 9.96 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
'''
Arachnid depends on several packages that cannot or should not be installed
using easy_install.
NumPY and SciPy fall into the should-not category because
they can be sped up substantially if you install a vendor tuned linear
algebra library first.
PySide has a more extensive set of installation requirements
and thus must be downloaded from their respective sites.
Matplotlib can use the PySide library if installed after PySide.
Compilers
---------
The following compilers are required if you install from the source:
- C compiler
- C++ compiler
- Fortran compiler
See `NumPY Installation <http://docs.scipy.org/doc/numpy/user/install.html#building-from-source>`_
for details on how to compile this source.
Checking
--------
You can check what dependencies you have installed (and accessible) with the following command:
.. sourcecode:: sh
$ python setup.py checkdep
running check
Checking for mpi4py: not found
---
Checking for numpy: found - 1.6.1
Checking for scipy: found - 0.10.0rc1
Checking for matplotlib: found - 1.1.0
Checking for PySide: found
Checking for matplotlib: found - 1.1.0
In the above example, only `mpi4py` was not installed.
Packages to Download
--------------------
- Vendor tuned linear algebra library (Required to run fast!)
- `ACML`_
- `MKL`_
- `Atlas`_
- `Lapack`_ / `Blas`_
- `Goto Blas`_
- Graphical user interface libraries (Required for GUI)
- `QT4`_
- `PySide`_
- Single particle reconstruction package
- `SPIDER`_ (Not required for installation but to run pySPIDER scripts)
- Scientific Python packages (Required)
- `Numpy`_
- `Scipy`_
- `Matplotlib`_
- `scikit-learn`_
- `scikit-image`_
- `Basemap`_
- `Pillow`_
- `mpi4py`_
- Database Packages
- `SQLAlchemy`_
- `MySQL-Python`_
- Other Packages
- `psutil`_
- `setuptools`_
.. _`mpi4py`: http://mpi4py.scipy.org/
.. _`SPIDER`: http://www.wadsworth.org/spider_doc/spider/docs/spi-register.html
.. _`ACML`: http://developer.amd.com/cpu/Libraries/acml/Pages/default.aspx
.. _`MKL`: http://software.intel.com/en-us/intel-mkl/
.. _`Atlas`: http://math-atlas.sourceforge.net/
.. _`Lapack`: http://www.netlib.org/lapack/
.. _`Blas`: http://www.netlib.org/blas/
.. _`Goto Blas`: http://www.tacc.utexas.edu/tacc-projects/gotoblas2/
.. _`QT4`: http://qt.nokia.com/
.. _`PySide`: http://qt-project.org/wiki/PySide
.. _`Numpy`: http://sourceforge.net/projects/numpy/files/
.. _`Scipy`: http://sourceforge.net/projects/scipy/files/
.. _`Matplotlib`: http://matplotlib.sourceforge.net/
.. _`Sphinx`: http://sphinx.pocoo.org/
.. _`scikit-image`: http://scikit-image.org/
.. _`scikit-learn`: http://scikit-learn.org/stable/
.. _`SQLAlchemy`: http://www.sqlalchemy.org/
.. _`MySQL-Python`: http://mysql-python.sourceforge.net/
.. _`Basemap`: http://matplotlib.org/basemap/
.. _`Pillow`: https://pillow.readthedocs.org/
.. _`psutil`: https://code.google.com/p/psutil/
.. _`setuptools`: http://pythonhosted.org/setuptools/setuptools.html
Installation of Prerequisites
-----------------------------
#. Install Vendor-tuned Linear Algebra Library
- `ACML`_
- `MKL`_
- `Atlas`_
- `Lapack`_ / `Blas`_
- `Goto Blas`_
.. note ::
For ACML, you need to install CBLAS from the source: http://www.netlib.org/clapack/cblas.tgz
Change the line with BLLIB to the following line in the appropriate Makefile (e.g. Makefile.LINUX)
BLLIB = -L/opt/acml4.4.0/gfortran64_mp/lib -lacml_mp -lacml_mv
CFLAGS = -O3 -DADD\_ -fPIC
Then invoke make:
$ make
And copy the resulting library to the ACML directory (if you want to follow the later steps closely)
cp lib/LINUX/cblas_LINUX.a /path-to-acml/libcblas.a
#. Install Python 2.6 or 2.7
#. Install setuptools
#. Install Numpy
Create `site.cfg` in the Numpy source root and add the following values depending
on where your vendor tuned library is install (this example is for ACML):
.. sourcecode :: sh
[blas]
blas_libs = cblas, acml_mp, acml_mv
library_dirs = /opt/acml4.4.0/gfortran64_mp/lib
include_dirs = /opt/acml4.4.0/gfortran64_mp/include
[lapack]
lapack_libs = cblas, acml_mp, acml_mv
library_dirs = /opt/acml4.4.0/gfortran64_mp/lib
include_dirs = /opt/acml4.4.0/gfortran64_mp/include
#. Install Scipy
#. Install Matplotlib (Required for plotting functions)
.. note::
If you plan on using the graphical user interface, install Qt4 and PySide (steps 9 and 10) before installing matplotlib
#. Install Qt4 (Required for graphical user interface)
#. Install PySide (Required for graphical user interface)
#. Setup Environment
For Bash:
.. sourcecode :: sh
# Setup path for BLAS Libraries
# With ACML
export BLAS_LIBS=acml:cblas:acml_mv
export BLAS_PATH=/opt/acml4.4.0/gfortran64_mp
export LD_LIBRARY_PATH=$BLAS_PATH/lib:$LD_LIBRARY_PATH
.. Created on Sep 28, 2010
.. codeauthor:: Robert Langlois <[email protected]>
'''
try:
import setuptools
setuptools;
except:
import ez_setup #@UnresolvedImport
ez_setup.use_setuptools()
import setuptools # @Reimport
setuptools;
import arachnid.distutils.sdist
import arachnid.distutils.check_dep
import os
import arachnid.setup
import sys
# QT UI support: https://bitbucket.org/jbmohler/qtviews/src/ead44bd27b38/setup.py
# Classifiers http://pypi.python.org/pypi?%3Aaction=list_classifiers
def build_description(package, extra=None):
'''Build a description from a Python package.
This function builds a description from the __init__ of a Python package.
:Parameters:
package : str
Name of the package
extra : dict
Keyword arguments to setup the package description
:Returns:
extra : dict
Keyword arguments to setup the package description
'''
from distutils import log # Workaround for conda build with jinga
import setuptools # @Reimport - Workaround for conda build with jinga
import sys # @Reimport
if extra is None: extra = {}
description = [('name', 'project'), 'version', 'author', 'license', 'author_email', 'description', 'url', 'download_url', 'keywords', 'classifiers', 'platforms']#, ('long_description', 'doc')
for d in description:
if isinstance(d, tuple): key, field = d
else: key, field = d, d
if hasattr(package, "__"+field+"__"):
val = getattr(package, "__"+field+"__")
if val is not None: extra[key] = val
try:
__import__(package.__name__+".setup").setup
log.info("Root config package %s"%(package.setup.__name__))
extra.update(package.setup.configuration(top_path='').todict())
except:
if os.path.basename(sys.argv[0]) != 'conda-build':
log.error("No setup file found in root package to build extensions")
#raise
extra['packages'] = setuptools.find_packages(exclude='pyspider')
return extra
def rglob(pattern, root=os.curdir):
'''Collect all files matching supplied filename pattern in and below supplied root directory.
:Parameters:
pattern : str
Wild card pattern for file search
root : str
Directory root to start the search
:Returns:
val : list
List of files
'''
import fnmatch # Workaround for conda build with jinga
filenames = []
for path, _, files in os.walk(os.path.abspath(root)):
for filename in fnmatch.filter(files, pattern):
filenames.append( os.path.join(path, filename) )
return filenames
def get_readme():
'''
'''
try: return open(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'README.rst')).read()
except: return None
def setup_package(**extra):
'''
'''
import sys # @Reimport
if ('build_sphinx' in sys.argv or 'sphinx-build' in sys.argv) and __name__ != '__main__': return # Do not invoke if sphinx is called
if len(sys.argv) > 1 and (sys.argv[1] in ('--help-commands', 'egg_info', '--version', '.', '') or '--help' in sys.argv or sys.argv[1].find('conda') != -1):
from setuptools import setup
setup(**extra)
else:
from numpy.distutils.core import setup # @Reimport
setup(**extra)
other_requires= [] if sys.platform == 'darwin' else ['mysql-python']
cmdclass = {'checkdep': arachnid.distutils.check_dep.check_dep, 'sdist':arachnid.distutils.sdist.sdist, 'version':arachnid.distutils.sdist.version}
try:
import sphinx.setup_command
cmdclass.update(build_docs=sphinx.setup_command.BuildDoc)
except:
from distutils import log
log.warn("Sphinx not installed!")
kwargs = build_description(arachnid)
setup_package(entry_points = {
'console_scripts': arachnid.setup.console_scripts,
'gui_scripts': arachnid.setup.gui_scripts
},
long_description = get_readme(),
data_files=[('rst', rglob("*.rst"))],
install_requires = [
#'numpy', # conda bug
'scipy',
'psutil',
'scikit-learn',
'scikit-image',
'mpi4py',
'matplotlib',
'sqlalchemy',
#'mysql-python', # changed from MySQL-Python to support Anaconda on Mac OSX
"Pillow",
'basemap',
'setuptools', #distribute
#'PySide',
] + other_requires,
#extras_require = dict(pyside="PySide"), #[pyside]
#setup_requires = [ - causes conda build to fail
#'Sphinx>=1.0.4',
#'nose>=1.0',
#],
cmdclass = cmdclass,
test_suite = 'nose.collector',
**kwargs
)