This repository has been archived by the owner on Oct 25, 2022. It is now read-only.
forked from voxel51/fiftyone
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.bash
155 lines (142 loc) · 4.33 KB
/
install.bash
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
#!/bin/bash
# Installs the `fiftyone` package and its dependencies.
#
# Usage:
# bash install.bash
#
# Copyright 2017-2022, Voxel51, Inc.
# voxel51.com
#
# Show usage information
usage() {
echo "Usage: bash $0 [-h] [-d] [-e] [-m] [-p] [-v]
Getting help:
-h Display this help message.
Custom installations:
-d Install developer dependencies.
-e Source install of voxel51-eta.
-m Install MongoDB from scratch, rather than installing fiftyone-db.
-p Install only the core python package, not the App.
-v Voxel51 developer install (don't install fiftyone-brain).
"
}
# Parse flags
SHOW_HELP=false
DEV_INSTALL=false
SOURCE_ETA_INSTALL=false
SCRATCH_MONGODB_INSTALL=false
BUILD_APP=true
VOXEL51_INSTALL=false
while getopts "hdempv" FLAG; do
case "${FLAG}" in
h) SHOW_HELP=true ;;
d) DEV_INSTALL=true ;;
e) SOURCE_ETA_INSTALL=true ;;
m) SCRATCH_MONGODB_INSTALL=true ;;
v) VOXEL51_INSTALL=true ;;
p) BUILD_APP=false ;;
*) usage ;;
esac
done
[ ${SHOW_HELP} = true ] && usage && exit 0
set -e
NODE_VERSION=17.9.0
OS=$(uname -s)
if [ ${SCRATCH_MONGODB_INSTALL} = true ]; then
echo "***** INSTALLING MONGODB *****"
mkdir -p ~/.fiftyone/bin
cd ~/.fiftyone
mkdir -p var/lib/mongo
INSTALL_MONGODB=true
if [ -x bin/mongod ]; then
VERSION_FULL=$(bin/mongod --version | grep 'db version')
VERSION="${VERSION_FULL:12}"
if [ ${VERSION} != "5.0.4" ]; then
echo "Upgrading MongoDB v${VERSION} to v5.0.4"
else
echo "MongoDB v5.0.4 already installed"
INSTALL_MONGODB=false
fi
else
echo "Installing MongoDB v5.0.4"
fi
if [ ${INSTALL_MONGODB} = true ]; then
if [ "${OS}" == "Darwin" ]; then
MONGODB_BUILD=mongodb-macos-x86_64-5.0.4
curl https://fastdl.mongodb.org/osx/${MONGODB_BUILD}.tgz --output mongodb.tgz
tar -zxvf mongodb.tgz
mv ${MONGODB_BUILD}/bin/* ./bin/
rm mongodb.tgz
rm -rf ${MONGODB_BUILD}
elif [ "${OS}" == "Linux" ]; then
MONGODB_BUILD=mongodb-linux-x86_64-ubuntu2004-5.0.4
curl https://fastdl.mongodb.org/linux/${MONGODB_BUILD}.tgz --output mongodb.tgz
tar -zxvf mongodb.tgz
mv ${MONGODB_BUILD}/bin/* ./bin/
rm mongodb.tgz
rm -rf ${MONGODB_BUILD}
else
echo "WARNING: unsupported OS, skipping MongoDB installation"
fi
fi
cd -
else
echo "***** INSTALLING FIFTYONE-DB *****"
pip install fiftyone-db
fi
if [ ${BUILD_APP} = true ]; then
echo "***** INSTALLING FIFTYONE-APP *****"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install ${NODE_VERSION}
nvm use ${NODE_VERSION}
npm -g install yarn
if [ -f ~/.bashrc ]; then
source ~/.bashrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
else
echo "WARNING: unable to locate a bash profile to 'source'; you may need to start a new shell"
fi
cd app
echo "Building the App. This will take a minute or two..."
yarn install > /dev/null 2>&1
yarn build
cd ..
fi
if [ ${VOXEL51_INSTALL} = false ]; then
echo "***** INSTALLING FIFTYONE-BRAIN *****"
pip install fiftyone-brain
fi
echo "***** INSTALLING FIFTYONE *****"
if [ ${DEV_INSTALL} = true ] || [ ${VOXEL51_INSTALL} = true ]; then
echo "Performing dev install"
pip install -r requirements/dev.txt
pre-commit install
pip install -e .
else
pip install -r requirements.txt
pip install .
fi
if [ ${SOURCE_ETA_INSTALL} = true ]; then
echo "***** INSTALLING ETA *****"
if [[ ! -d "eta" ]]; then
echo "Cloning ETA repository"
git clone https://github.com/voxel51/eta
fi
cd eta
git checkout develop
git pull
if [ ${DEV_INSTALL} = true ] || [ ${VOXEL51_INSTALL} = true ]; then
pip install -e .
else
pip install .
fi
if [[ ! -f eta/config.json ]]; then
echo "Installing default ETA config"
cp config-example.json eta/config.json
fi
cd ..
fi
echo "***** INSTALLATION COMPLETE *****"