forked from mdenil/txtnets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_environment.sh
executable file
·141 lines (107 loc) · 2.96 KB
/
setup_environment.sh
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
#!/bin/bash
set -e
ROOT="$(pwd)"
DATA="$ROOT/data"
RESULTS="$ROOT/results"
PLATFORM="$(uname)"
LOCAL_TAG="$PLATFORM"
EXTERNAL="$ROOT/venvs/$LOCAL_TAG/external"
LIB="$ROOT/venvs/$LOCAL_TAG/lib"
BIN="$ROOT/venvs/$LOCAL_TAG/bin"
ENV="$ROOT/venvs/$LOCAL_TAG/env"
function safe_call {
# usage:
# safe_call function param1 param2 ...
HERE="$(pwd)"
"$@"
cd "$HERE"
}
function conda_install {
conda install --yes "$@"
}
function pip_install {
pip install "$@"
}
function install_cld2 {
cd "$EXTERNAL"
# build cld2
svn checkout http://cld2.googlecode.com/svn/trunk/ cld2
cd cld2/internal/
if [[ "$PLATFORM" == "Darwin" ]]; then
sed -i -e 's/^g++/g++-4.8/' compile_libs.sh
fi
./compile_libs.sh
mv libcld2_full.so libcld2.so "$LIB"
# build python bindings for cld2
cd "$EXTERNAL"
hg clone https://code.google.com/p/chromium-compact-language-detector/
cd chromium-compact-language-detector
sed -i -e "/include_dirs/ s~$~library_dirs=\['$LIB'\],~" setup.py setup_full.py
python setup.py install
python setup_full.py install
}
function install_word2vec {
cd "$EXTERNAL"
svn checkout http://word2vec.googlecode.com/svn/trunk/ word2vec
cd word2vec
make
cp word2vec "$BIN/."
}
function install_pycuda {
cd "$EXTERNAL"
safe_call pip_install Mako
git clone --recursive http://git.tiker.net/trees/pycuda.git
cd pycuda
python configure.py
python setup.py build
python setup.py install
}
function install_scikits-cuda {
cd "$EXTERNAL"
git clone https://github.com/lebedov/scikits.cuda.git
cd scikits.cuda
python setup.py install
}
function install_reikna {
cd "$EXTERNAL"
git clone https://github.com/Manticore/reikna.git
cd reikna
python setup.py install
}
mkdir -p "$EXTERNAL"
mkdir -p "$LIB"
mkdir -p "$BIN"
mkdir -p "$DATA"
mkdir -p "$RESULTS"
export LD_LIBRARY_PATH="$LIB"
conda create --yes --prefix "$ENV" python=2.7 pip
source activate "$ENV"
# you also need to install fftw
safe_call conda_install numpy scipy mkl
safe_call conda_install matplotlib
safe_call conda_install psutil
safe_call conda_install nose
safe_call conda_install ipython pyzmq jinja2 tornado
safe_call conda_install nltk
safe_call conda_install pandas
safe_call conda_install beautiful-soup
safe_call conda_install requests
safe_call conda_install statsmodels patsy
safe_call conda_install cython
safe_call conda_install gensim
#safe_call conda_install -c https://conda.binstar.org/richli fftw
#safe_call conda_install -c https://conda.binstar.org/richli pyfftw
safe_call pip_install pyfftw
safe_call pip_install pyprind
safe_call pip_install --pre line_profiler
safe_call pip_install ruffus
safe_call pip_install sh
safe_call pip_install simplejson
safe_call pip_install seaborn
#safe_call install_cld2
safe_call install_word2vec
if [ "$1" == "--cuda" ]; then
safe_call install_pycuda
safe_call install_scikits-cuda
safe_call install_reikna
fi