forked from gadgetron/gadgetron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_ubuntu_dependencies.sh
executable file
·129 lines (116 loc) · 3.78 KB
/
install_ubuntu_dependencies.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
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
if [ -z "$(cat /etc/lsb-release | grep "Ubuntu 20.04")" ] && [ -z "$(cat /etc/lsb-release | grep "Ubuntu 18.04")" ]; then
echo "Error: This install script is intended for Ubuntu 18.04 and 20.04 only"
exit 1
fi
apt update --quiet
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests --yes \
apt-utils \
build-essential \
cmake \
cpio \
cython3 \
gcc-multilib \
git-core \
h5utils \
hdf5-tools \
jove \
jq \
libace-dev \
libarmadillo-dev \
libatlas-base-dev \
libboost-all-dev \
libcrypto++-dev \
libfftw3-dev \
libfreetype6-dev \
libgtest-dev \
libhdf5-serial-dev \
liblapack-dev \
liblapacke-dev \
libopenblas-base \
libopenblas-dev \
libplplot-dev \
libpugixml-dev \
libxml2-dev \
libxslt-dev \
net-tools \
ninja-build \
pkg-config \
python3-dev \
python3-pip \
software-properties-common \
supervisor \
wget
if [ -z "$(cat /etc/lsb-release | grep "Ubuntu 18.04")" ]; then
# This is NOT ubuntu 18.04, i.e. it is 20.04
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests --yes \
googletest \
googletest-tools \
librange-v3-dev
else
# Let's get GCC/G++9
add-apt-repository --yes --update ppa:ubuntu-toolchain-r/test
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests --yes \
g++-9 \
gcc-9 \
git
# Set v9 with higher priority
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 --slave /usr/bin/g++ g++ /usr/bin/g++-9
# install range v3
mkdir -p /opt/code
cd /opt/code && \
git clone https://github.com/ericniebler/range-v3.git --depth 1 --branch 0.11.0 && \
cd range-v3 && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release ../ -GNinja && \
ninja && ninja install && cd /opt/code && rm -rf /opt/code/range-v3
# Install Google Test
cd /opt/code && \
git clone https://github.com/google/googletest.git && \
cd googletest && \
mkdir build && \
cd build && \
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ../ && \
make -j $(nproc) && make install && cd /opt/code && rm -rf /opt/code/googletest
fi
# Install ZFP
mkdir -p /opt/code
cd /opt/code && \
git -c advice.detachedHead=false clone --branch 0.5.5 --single-branch https://github.com/LLNL/zfp.git \
cd zfp && \
mkdir build && \
cd build && \
cmake ../ && \
cmake --build . --config Release --parallel $(nproc) && cmake --install . && cd /opt/code && rm -rf /opt/code/zfp
pip3 install -U pip setuptools testresources
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests --yes python3-tk
# h5py needs to be recompiled to compile agains HDF5 1.10, which is what we install on Ubuntu 20.04
pip3 install --no-binary=h5py h5py
# Rest of the Python "stuff"
pip3 install \
Cython \
matplotlib \
numpy \
opencv_python \
pydicom \
Pillow \
pyxb \
scikit-image \
scikit-learn \
scipy \
sympy \
tk-tools
pip3 install git+https://github.com/ismrmrd/ismrmrd-python.git
pip3 install git+https://github.com/gadgetron/gadgetron-python.git
# If this is an image with CUDA...
if [ -f /usr/local/cuda/bin/nvcc ]; then
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --no-install-suggests --yes libcudnn8-dev
pip3 install torch==1.7.0+cu110 torchvision==0.8.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html
else
pip3 install torch==1.7.0+cpu torchvision==0.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
fi