-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcobConda.sh
executable file
·185 lines (167 loc) · 6.22 KB
/
cobConda.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
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
#!/bin/bash
# Script to setup camoco in an anaconda environment
# Written by Joe Jeffers
# Email: [email protected]
# Updated January 20, 2015
# Configurable variables
export NAME="cobBox"
[ -z "$BASE" ] && { echo "Need to set the BASE env variable as the base camoco install dir"; exit 1; }
[ -z "$GH_USER" ] && { echo "Need to set GH_USER env variable"; exit 1; }
#===================================================
#----------Setup the build Environment--------------
#===================================================
echo "Setting up the build environment"
source $HOME/.bashrc
cd $BASE
mkdir -p $BASE/.local/lib
mkdir -p $BASE/.local/bin
mkdir -p $BASE/.conda
export LD_LIBRARY_PATH=$BASE/.local/lib:$LD_LIBRARY_PATH
export PATH=$BASE/.local/bin:$PATH
#===================================================
#----------------Install conda ---------------------
#===================================================
if ! hash conda 2>/dev/null ; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -f -p $BASE/.local/conda
rm -rf miniconda.sh
export PATH=/heap/jeffe174/.local/conda/bin:$PATH
fi
#===================================================
#----------------Install git lfs--------------------
#===================================================
echo "Installing git-lfs for the large files in the repo"
cd $BASE
wget https://github.com/github/git-lfs/releases/download/v1.1.0/git-lfs-linux-amd64-1.1.0.tar.gz
tar xzf git-lfs-linux-amd64-1.1.0.tar.gz
rm -rf git-lfs-linux-amd64-1.1.0.tar.gz
cd git-lfs-1.1.0/
rm -rf $BASE/.local/bin/git-lfs*
mv git-lfs $BASE/.local/bin/
cd $BASE
rm -rf git-lfs*
git lfs install
git lfs uninstall
#===================================================
#--------------Get the Camoco Repo------------------
#===================================================
if [ ! -d $BASE/Camoco ]
then
git config --global credential.helper cache
echo "Cloning the Camoco repo into $BASE"
cd $BASE
git clone https://github.com/$GH_USER/Camoco.git $BASE/Camoco
# Username: schae234
# Password: HelloGitLFS
fi
export PYTHONPATH=$PYTHONPATH:$BASE/Camoco
#===================================================
#-----Install libraries to Ensure Smoothness--------
#===================================================
if [ ! -e $BASE/.local/bin/icu-config ]
then
echo "Installing a local version of the icu library"
cd $BASE
wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/icu_4.8.1.1.orig.tar.gz
echo "Extracting the tarball"
tar xzf icu_4.8.1.1.orig.tar.gz
rm -rf icu_4.8.1.1.orig.tar.gz
cd icu/source
./configure --prefix=$BASE/.local
make
make install
cd $BASE
rm -rf icu/
fi
if [ ! -e $BASE/.local/lib/libqhull.so ]
then
echo "Installing a local version of the qhull library"
cd $BASE
wget http://www.qhull.org/download/qhull-2012.1-src.tgz
echo "Extracting the tarball"
tar xzf qhull-2012.1-src.tgz
rm -rf qhull-2012.1-src.tgz
cd qhull-2012.1
make
mv bin/* $BASE/.local/bin/
mv lib/* $BASE/.local/lib
ln -s $BASE/.local/lib/libqhull.so $BASE/.local/lib/libqhull.so.5
cd $BASE
rm -rf qhull-2012.1/
fi
#===================================================
#------------------Install mcl----------------------
#===================================================
if [ ! -e $BASE/.local/bin/mcl ]
then
echo "Installing mcl locally"
cd $BASE
wget http://micans.org/mcl/src/mcl-latest.tar.gz
echo "Extracting the taball"
tar xzvf mcl-latest.tar.gz
rm -rf mcl-latest.tar.gz
cd $(find . -name 'mcl-*' -type d | head -n 1)
./configure --prefix=$BASE/.local
make
make install
cd $BASE
rm -rf $(find . -name 'mcl-*' -type d | head -n 1)
fi
#===================================================
#----------Build the Conda Environment--------------
#===================================================
echo "Making the conda virtual environment named $NAME in $BASE/.conda"
cd $BASE
conda config --add envs_dirs $BASE/.conda
conda remove -y --name $NAME --all
conda create -y -n $NAME python=3.4 anaconda setuptools pip distribute cython==0.22.1 nose six pyyaml yaml pyparsing python-dateutil pytz numpy scipy pandas matplotlib==1.4.3 numexpr patsy statsmodels pytables flask networkx ipython mpmath pytest
conda install --no-update-deps -y -n $NAME -c http://conda.anaconda.org/omnia termcolor
conda install --no-update-deps -y -n $NAME -c http://conda.anaconda.org/cpcloud ipdb
source activate $NAME
#==================================================
#----------Take care of some pip packages ---------
#==================================================
pip install powerlaw
pip install sklearn
#===================================================
#-----------------Install apsw----------------------
#===================================================
echo "Installing apsw into the conda environment"
cd $BASE
rm -rf apsw
git clone https://github.com/rogerbinns/apsw.git
cd apsw
python setup.py fetch --missing-checksum-ok --all build --enable-all-extensions install
cd $BASE
rm -rf apsw
#===================================================
#------------Update the bashrc----------------------
#===================================================
echo "Update your $HOME/.bashrc if needed:"
# Add the main local bin folder
if ! grep -q "PATH=$BASE/.local/bin" $HOME/.bashrc
then
echo "export PATH=$BASE/.local/bin:\$PATH" >> $HOME/.bashrc
fi
# Add the conda bin folder
if ! grep -q "PATH=$BASE/.local/conda/bin" $HOME/.bashrc
then
echo "export PATH=$BASE/.local/conda/bin:\$PATH" >> $HOME/.bashrc
fi
# Add Camoco to your python path
if ! grep -q "$BASE/Camoco" $HOME/.bashrc
then
echo "export PYTHONPATH=\$PYTHONPATH:$BASE/Camoco" >> $HOME/.bashrc
fi
# Add the local library to your lib path
if ! grep -q "LD_LIBRARY_PATH=$BASE/.local/lib" $HOME/.bashrc
then
echo "export LD_LIBRARY_PATH=$BASE/.local/lib:\$LD_LIBRARY_PATH" >> $HOME/.bashrc
fi
#===================================================
#-------------Use Instructions----------------------
#===================================================
echo " "
echo "All done, to use your new environment, first restart the shell."
echo "Then type: source activate $NAME"
echo "To leave it, type: source deactivate"