forked from see4c/codalab-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·64 lines (55 loc) · 1.46 KB
/
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
#!/bin/bash
# Setup script for Linux.
# Exit immediately if any command fails
set -e
if [ "$#" -ne 1 ] || ( [ "$1" != "client" ] && [ "$1" != "server" ] ); then
echo "Usage:"
echo " $0 [client | server]"
exit 1
fi
echo "=== Checking for virtualenv..."
if ! which virtualenv; then
echo "Python virtualenv is not installed."
echo "If you are using Ubuntu, run the following to install:"
echo
echo " sudo apt-get install python-virtualenv"
exit 1
fi
echo
codalabdir=`dirname $0`
env=$codalabdir/venv
if [ ! -e $env ]; then
echo "=== Setup a Python virtual environment (in $env)..."
virtualenv -p /usr/bin/python2.7 $env
echo
fi
echo "=== Install Python packages into $env..."
$env/bin/pip install -r $codalabdir/requirements.txt
if [ "$1" == "server" ]; then
$env/bin/pip install -r $codalabdir/requirements-server.txt
fi
( # try
$env/bin/pip install psutil || exit 1
) || ( # catch
echo
echo " psutil failed to install"
echo "This is most likely happening because of missing python-dev"
echo "If you are using Ubuntu, run the following to install:"
echo
echo " sudo apt-get install python-dev"
echo
exit 3
)
if [ $? = 3 ]; then
exit
fi
#echo "=== Initializing the database..."
#$env/bin/alembic stamp head
echo
echo "=== Add the following line to your .bashrc to put CodaLab in your path:"
echo
echo " export PATH=\$PATH:$PWD/codalab/bin"
echo
echo "Then you can use Codalab with the single command:"
echo
echo " cl"