-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathinstall.sh
executable file
·170 lines (141 loc) · 5.4 KB
/
install.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
#!/bin/bash
# Recover the project directory from the position of the install.sh script
HERE=`dirname $0`
HERE=`realpath $HERE`
# Local variables
PROJECT_NAME=deep_view_aggregation
YML_FILE=${HERE}/${PROJECT_NAME}.yml
TORCH=1.7.1
CUDA_SUPPORTED=(10.1 10.2 11.0 11.2 11.4)
# Installation script for Anaconda3 environments
echo "#############################################"
echo "# #"
echo "# Deep View Aggregation #"
echo "# Installer #"
echo "# #"
echo "#############################################"
echo
echo
echo "_______________ Prerequisites _______________"
echo " - conda"
echo " - cuda >= 10.1 (tested with `echo ${CUDA_SUPPORTED[*]}`)"
echo " - gcc >= 7"
echo
echo
echo "____________ Pick conda install _____________"
echo
# Recover the path to conda on your machine
CONDA_DIR=`realpath ~/anaconda3`
while (test -z $CONDA_DIR) || [ ! -d $CONDA_DIR ]
do
echo "Could not find conda at: "$CONDA_DIR
read -p "Please provide you conda install directory: " CONDA_DIR
CONDA_DIR=`realpath $CONDA_DIR`
done
echo "Using conda conda found at: ${CONDA_DIR}/etc/profile.d/conda.sh"
source ${CONDA_DIR}/etc/profile.d/conda.sh
echo
echo
echo "_____________ Pick CUDA version _____________"
echo
CUDA_SUPPORTED=(10.2 11.2 11.4)
CUDA_VERSION=`nvcc --version | grep release | sed 's/.* release //' | sed 's/, .*//'`
CUDA_MAJOR=`echo $CUDA_VERSION | sed 's/\..*//'`
CUDA_MINOR=`echo $CUDA_VERSION | sed 's/.*\.//'`
CUDA_MINOR_TORCH=`echo $CUDA_MINOR`
CUDA_MINOR_TV=`echo $CUDA_MINOR`
CUDA_MINOR_PYG=`echo $CUDA_MINOR`
# If CUDA version not supported, ask whether to proceed
if [[ ! " ${CUDA_SUPPORTED[*]} " =~ " ${CUDA_VERSION} " ]]
then
echo "Found CUDA ${CUDA_VERSION} installed, is not among tested versions: "`echo ${CUDA_SUPPORTED[*]}`
echo "This may cause downstream errors when installing PyTorch and PyTorch Geometric dependencies, which you might solve by manually modifying setting the wheels in this script."
read -p "Proceed anyways ? [y/n] " -n 1 -r; echo
if !(test -z $REPLY) && [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
fi
# Adjusting CUDA minor to match existing PyTorch and PyTorch Geometric
# wheels
if [[ ${CUDA_MAJOR} == 10 && ${CUDA_MINOR} == 0 ]]
then
CUDA_MINOR_TORCH=1
CUDA_MINOR_TV=1
CUDA_MINOR_PYG=1
fi
if [[ ${CUDA_MAJOR} == 10 && ${CUDA_MINOR} > 1 ]]
then
CUDA_MINOR_TORCH=2
CUDA_MINOR_TV=1
CUDA_MINOR_PYG=2
fi
if [[ ${CUDA_MAJOR} == 11 ]]
then
CUDA_MINOR_TORCH=0
CUDA_MINOR_TV=0
CUDA_MINOR_PYG=0
fi
# Summing up used CUDA versions
cuXXX_TORCH=`echo "cu"${CUDA_MAJOR}${CUDA_MINOR_TORCH}`
cuXXX_TV=`echo "cu"${CUDA_MAJOR}${CUDA_MINOR_TV}`
cuXXX_PYG=`echo "cu"${CUDA_MAJOR}${CUDA_MINOR_PYG}`
echo "CUDA version installed: ${CUDA_MAJOR}.${CUDA_MINOR}"
echo "CUDA version used for Torch: ${CUDA_MAJOR}.${CUDA_MINOR_TORCH}"
echo "CUDA version used for TorchVision: ${CUDA_MAJOR}.${CUDA_MINOR_TV}"
echo "CUDA version used for Torch Geometric: ${CUDA_MAJOR}.${CUDA_MINOR_PYG}"
echo
echo
echo "________________ Installation _______________"
echo
# Create deep_view_aggregation environment from yml
conda env create -f ${YML_FILE}
# Activate the env
source ${CONDA_DIR}/etc/profile.d/conda.sh
conda activate ${PROJECT_NAME}
# Dependencies not installed from the .yml
# See https://pytorch.org/get-started/previous-versions/ if wheel issues
pip install torch==${TORCH}+${cuXXX_TORCH} torchvision==0.8.2+${cuXXX_TV} --no-cache-dir -f https://download.pytorch.org/whl/torch_stable.html
pip install torchnet
# Install torch-geometric and dependencies
# See https://pytorch-geometric.com/whl/ if wheel issues
pip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-${TORCH}+${cuXXX_PYG}.html
pip install --no-index torch-sparse -f https://pytorch-geometric.com/whl/torch-${TORCH}+${cuXXX_PYG}.html
pip install --no-index torch-cluster -f https://pytorch-geometric.com/whl/torch-${TORCH}+${cuXXX_PYG}.html
pip install --no-index torch-spline-conv -f https://pytorch-geometric.com/whl/torch-${TORCH}+${cuXXX_PYG}.html
pip install torch-geometric==1.6.3
pip install torch-points-kernels==0.6.10 --no-cache-dir
# Additional dependencies
pip install omegaconf
pip install wandb
pip install tensorboard
pip install plyfile
pip install hydra-core==1.1.0
pip install pytorch-metric-learning
pip install matplotlib
pip install seaborn
pip install pykeops==1.4.2
pip install imageio
pip install opencv-python
pip install pypng
pip install git+http://github.com/CSAILVision/semantic-segmentation-pytorch.git@master
pip install h5py
pip install faiss-gpu===1.6.5
# Install MinkowskiEngine
sudo apt install libopenblas-dev
pip install -U MinkowskiEngine==v0.4.3 --install-option="--blas=openblas" -v --no-deps
# Install torchsparse
sudo apt-get install libsparsehash-dev
pip install --upgrade git+https://github.com/mit-han-lab/[email protected]
#pip install --upgrade git+https://github.com/mit-han-lab/[email protected]
# Install plotly and associated jupyter requirements
pip install plotly==5.4.0
pip install "jupyterlab>=3" "ipywidgets>=7.6"
pip install jupyter-dash
jupyter labextension install @jupyter-widgets/jupyterlab-manager [email protected]
echo "NB: In case you want to use our notebooks, make sure the 'deep_view_aggregation' kernel is accessible in jupyterlab"
echo
echo
echo "Successfully installed Deep View Aggregation."
echo
echo