11#! /bin/bash
22# This script runs the same sequence as the CircleCI build
3+ # Run this as:
4+ # bin/setup
5+
36
47# Fail on the first error; killable by SIGINT
58set -e
69trap " exit" INT
710
11+
12+ read -p "
13+ ================================================
14+
15+ Welcome to the OpenAI Lab setup script;
16+ This will invoke sudo; alternatively,
17+ inspect bin/setup_ubuntu or bin/setup_macOS and run the lines manually.
18+
19+ Press enter to continue, Ctrl+c to quit:
20+
21+ ================================================
22+ "
23+
824# copy keys file if not already exist
925BIN_DIR=` pwd` /bin
1026$BIN_DIR /copy-config
1127
12- # install system dependencies
13- if [ $( uname) == " Darwin" ]; then
14- if which brew > /dev/null; then
15- echo " Brew is already installed"
16- else
17- ruby -e " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) "
18- fi
19- else
20- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update
21- sudo apt-get install -y gcc-4.9 g++-4.9 libhdf5-dev libopenblas-dev git
28+ # determine if is Mac OSX, or Linux; then run accordingly
29+ if [ $( uname) == " Darwin" ];
30+ # Mac runs below
31+ then (
32+ $BIN_DIR /setup_macOS;
33+ );
34+ else (
35+ $BIN_DIR /setup_ubuntu;
36+ );
2237fi
2338
24- # install python
25- if which python3 > /dev/null; then
26- echo " Python3 is already installed"
27- else
28- if [ $( uname) == " Darwin" ]; then
29- brew install python3
30- else
31- sudo apt-get -y install python3-dev python3-pip python3-setuptools
32- fi
33- fi
3439
35- # install nodejs (for npm and file watcher)
36- if which node > /dev/null; then
37- echo " Nodejs is already installed"
38- else
39- if [ $( uname) == " Darwin" ]; then
40- brew install node
41- else
42- curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
43- sudo apt-get install -y nodejs
44- fi
45- fi
40+ echo "
41+ ================================================
4642
47- # install npm modules
48- if [ -d ./node_modules ]; then
49- echo " Npm modules already installed"
50- else
51- npm install
52- sudo npm i -g grunt-cli
53- fi
43+ Setup done.
44+ Running basic installation checks.
5445
55- # install noti
56- if [ $( uname) == " Darwin" ]; then
57- curl -L https://github.com/variadico/noti/releases/download/v2.5.0/noti2.5.0.darwin-amd64.tar.gz | tar -xz
58- sudo mv noti /usr/local/bin/
59- else
60- curl -L https://github.com/variadico/noti/releases/download/v2.5.0/noti2.5.0.linux-amd64.tar.gz | tar -xz
61- sudo mv noti /usr/bin/
62- fi
46+ ================================================
47+ "
6348
64- # install common dependencies from from
65- sudo python3 -m pip install -U pip
66- sudo python3 -m pip install six
67- sudo python3 -m pip install h5py
68- sudo python3 -m pip install numpy
69- sudo python3 -m pip install scipy
70- sudo python3 -m pip install matplotlib
71- sudo python3 -m pip install seaborn
72- sudo python3 -m pip install pandas
73- sudo python3 -m pip install atari_py
74- sudo python3 -m pip install Pillow
75- sudo python3 -m pip install PyOpenGL
76- sudo python3 -m pip install glances
77- sudo python3 -m pip install mem_top
78- sudo python3 -m pip install pytest-cov
79- sudo python3 -m pip install pytest-xdist
80- sudo python3 -m pip install codacy-coverage
81-
82- # install tensorflow
83- if [ $( uname) == " Darwin" ]; then
84- sudo python3 -m pip install tensorflow
85- else
86- sudo python3 -m pip install tensorflow-gpu
87- fi
49+ # post-installation checks
8850python3 -c " import tensorflow; print('tensorflow version:'); print(tensorflow.__version__)"
89-
90- # install theano
91- if which clang > /dev/null; then
92- echo " clang is already installed"
93- else
94- if [ $( uname) == " Darwin" ]; then
95- brew install --with-clang llvm
96- fi
97- fi
98- # sudo pip3 install --upgrade --no-deps git+git://github.com/Theano/Theano.git
99- sudo python3 -m pip install theano==0.8.2
100- python3 -c " import theano; print('theano version:'); print(theano.__version__)"
101-
102- # install keras
103- sudo python3 -m pip install keras
104-
105- # install full openai gym
106- if [ $( uname) == " Darwin" ]; then
107- brew install cmake boost boost-python sdl2 swig wget
108- else
109- sudo apt-get install -y cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
110- fi
111- git clone https://github.com/openai/gym.git && cd gym && sudo python3 -m pip install -e .[all] && cd ..
112- git clone https://github.com/pybox2d/pybox2d && cd pybox2d/ && sudo python3 setup.py clean && sudo python3 setup.py build && sudo python3 setup.py install && cd ..
11351python3 -c " import gym; gym.make('LunarLander-v2')"
11452python3 -c " import gym; gym.make('SpaceInvaders-v0')"
53+
54+
55+ echo "
56+ ================================================
57+
58+ Installation complete.
59+
60+ ================================================
61+ "
0 commit comments