-
Notifications
You must be signed in to change notification settings - Fork 0
/
latest.sh
183 lines (155 loc) · 4.91 KB
/
latest.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
#!/bin/bash
#
# phy-latest install script
#
INSTALL_MINICONDA=1
MINICONDA_PATH=$HOME/miniconda
VENV=''
DEV=0
if [[ -t 0 ]]; then # we're in a terminal!
BATCH=0
else
BATCH=1 # running automated
fi
USAGE_MSG='usage:\n
-b run install in batch mode (without manual intervention),\n
-h print this help message and exit\n
-d development version (--pre)
-s skip installation of miniconda (just install phy)\n
-p PREFIX miniconda install path, defaults to $MINICONDA_PATH
'
printf 'Welcome to the phy installer (by the Kwik Team).\n\n'
while getopts "bhdsp:" x; do
case "$x" in
h)
echo -e $USAGE_MSG
exit 2
;;
d)
DEV=1
;;
b)
BATCH=1
;;
p)
MINICONDA_PATH="$OPTARG"
;;
s)
INSTALL_MINICONDA=0
;;
?)
echo "Error: did not recognize option"
echo -e $USAGE_MSG
exit 1
;;
esac
done
if [[ $BATCH == 0 ]] # interactive mode
then
printf 'We strongly recommend the use of miniconda or anaconda by
Continuum Analytics.\n\n'
printf 'If you wish to use another Python distribution
instead, then please press CTRL+C to cancel this installation, and
manually install the latest versions of the required packages listed
on http://phy.cortexlab.net/.\n\n'
printf 'If you already have miniconda installed, or are updating from a
previous version of phy, then please type "No" to skip this step.\n\n'
DEFAULT="yes"
echo -n "Download and install 64-bit Miniconda? [yes|no]
[$DEFAULT] >>> "
read ans
if [[ $ans == "" ]]; then
ans=$DEFAULT
fi
if [[ ($ans != "yes") && ($ans != "Yes") && ($ans != "YES") &&
($ans != "y") && ($ans != "Y")]]
then
echo "
Skipping install of miniconda...
"
INSTALL_MINICONDA=0
else
INSTALL_MINICONDA=1
fi
fi
if [[ $INSTALL_MINICONDA == 1 ]]; then
if [[ `uname -s` == 'Linux' ]]; then
if [[ `uname -m` == 'x86_64' ]]; then
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $MINICONDA_PATH
else
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86.sh
bash Miniconda3-latest-Linux-x86.sh -b -p $MINICONDA_PATH
fi
BASH_RC=$HOME/.bashrc
elif [[ `uname -s` == 'Darwin' ]]; then
if [[ `uname -m` == 'x86_64' ]]; then
curl -LO http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p $MINICONDA_PATH
else
echo "32-bit Mac OS is no longer supported. Please install miniconda and phy manually."
fi
BASH_RC=$HOME/.bash_profile
else
echo "
Your operating system does not seem to be supported. Please file an issue
on https://github.com/phy/issues
"
exit 1
fi
if [ -f $BASH_RC ]; then
echo "
Prepending PATH=$MINICONDA_PATH/bin to PATH in $BASH_RC
A backup will be made to: ${BASH_RC}-miniconda.bak
"
cp $BASH_RC ${BASH_RC}-miniconda.bak
else
echo "
Prepending PATH=$MINICONDA_PATH/bin to PATH in
newly created $BASH_RC"
fi
echo "
# added by Miniconda 3.7.0 installer
export PATH=\"$MINICONDA_PATH/bin:\$PATH\"" >>$BASH_RC
export PATH=$MINICONDA_PATH/bin:$PATH
fi # finished installing miniconda
if [[ $BATCH == 0 ]]; then
printf 'Would you like to create a new Python virtual environment for phy?
If you are planning on running other Python scripts which require
different versions of packages, please supply a name to create an environment.
You will need to activate this venv prior to using phy every time.
'
echo -n "
Virtual environment name (no spaces) (leave blank for none) [$VENV] >>> "
read VENV
fi # batch mode
if [[ ($VENV != '') ]]; then # create a venv
conda create -q -n $VENV python=3.4 --yes
source activate $VENV
fi # venv creation
# Install all dependencies
conda install pip numpy matplotlib scipy h5py pyqt ipython-notebook requests six --yes
# Install klustakwik
conda install -c http://conda.anaconda.org/kwikteam/ klustakwik2 --yes
# Install VisPy and phy
pip install vispy
if [[ $DEV == 0 ]]; then
pip install phy
else
pip install git+https://github.com/kwikteam/phy
fi
echo "
Thank you for installing phy!"
if [[ $VENV != '' ]]; then
echo "Before using phy, you must type \"source activate $VENV\"
to activate the virtual environment in every new terminal you create.
"
fi
echo "You can manually cluster a dataset with \"phy cluster-manual myfile.kwik\"
Launch an IPython Notebook to analyse your data with \"ipython notebook\"
For help and more documentation, visit http://phy.cortexlab.net.
"
echo "Please close this terminal and open a new one before running
phy for the first time.
"
exit 0