-
Notifications
You must be signed in to change notification settings - Fork 0
/
python_setup.sh
192 lines (114 loc) · 3.17 KB
/
python_setup.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
186
187
188
189
190
191
192
# declare variables
CUR_DIR="$(pwd)"
LIBS_DIR="libs"
env_name="dmas"
python_install(){
check_env
#flow_requirements
if [ ! $CONDA_DEFAULT_ENV = $env_name ] || [ -z $CONDA_DEFAULT_ENV ] ; then
echo "Please restart your terminal session and source the conda env with:"
echo "'source activate $env_name'"
echo "Then run the script again"
exit 1
fi
# call install script for sumo
sumo_install
ray_installation
pip install -r requirements.txt
# install sumo tools
pip install https://akreidieh.s3.amazonaws.com/sumo/flow-0.4.0/sumotools-0.4.0-py3-none-any.whl
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.9) Done with sumo tools, configuring setup "
fi
cd $CUR_DIR
# configure package
python setup.py install
# instlaling stable baseline
pip install stable-baselines
}
ray_installation(){
if [ ! -d "$LIBS_DIR/ray" ]; then
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.7) Installing ray"
fi
# Install flow develop
echo "Installing ray..."
conda install -y libgcc
pip install cython==0.29.0
cd $LIBS_DIR
git clone https://github.com/ray-project/ray.git
git checkout releases/0.7.6
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.71) Installing bazel"
fi
# Install Bazel.
ray/ci/travis/install-bazel.sh
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.72) Done with bazel, installing pip devel "
fi
# Install Ray.
cd ray/python
pip setup.py install --verbose # Add --user if you see a permission denied error.
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.73) Done with pip devel "
fi
else
echo "Ray direcotry detected. Skipping installation"
fi
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.8) Done with ray, installin sumo tools "
fi
cd $CUR_DIR
}
sumo_install(){
echo "Installing SUMO..."
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.5) Installing sumo"
fi
os="$(uname)"
cd $LIBS_DIR
if [ $os = "Darwin" ]; then
sh scripts/sumo_setup/setup_sumo_osx.sh
elif [ $os = "Linux" ]; then
sh scripts/sumo_setup/setup_sumo_ubuntu1804.sh
fi
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.6) Done with sumo"
fi
cd $CUR_DIR
}
flow_requirements(){
if [ ! -d "$LIBS_DIR/flow" ]; then
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.1) Installing flow"
fi
# install flow if not present
cd $LIBS_DIR
git clone https://github.com/flow-project/flow.git
cd flow
# update conda
conda update conda -y
# create envirnonment
echo "Creating enviroment..."
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.2) Creating conda env "
fi
# install requirements
pip install -r requirements.txt
echo "Installed requirements for flow"
fi
if [ $DEBUG_flag ]; then
echo "[$DEBUG_id] 3.3) Done with flow"
fi
}
check_env(){
env="$(conda env list | grep $env_name)"
if [ -z $env ]; then
echo "No conda environment detected!"
echo "Run:"
echo "conda create -n $env_name python=3.6"
echo "Source it with:"
echo "conda activate $env_name"
exit 1
fi
}