-
Notifications
You must be signed in to change notification settings - Fork 0
/
paperspace-ubuntu2204.sh
385 lines (306 loc) · 13.5 KB
/
paperspace-ubuntu2204.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
#!/bin/bash
# ==================================================================
# Module list
# ------------------------------------------------------------------
# python 3.11.6 (apt)
# pip3 23.3.1 (apt)
# cuda toolkit 12.1.1 (apt)
# cudnn 8.9.3 (apt)
# torch 2.1.1 (pip)
# torchvision 0.16.1 (pip)
# torchaudio 2.1.1 (pip)
# tensorflow 2.15.0 (pip)
# transformers 4.35.2 (pip)
# datasets 2.14.5 (pip)
# peft 0.6.2 (pip)
# tokenizers 0.13.3 (pip)
# accelerate 0.24.1 (pip)
# diffusers 0.21.4 (pip)
# safetensors 0.4.0 (pip)
# jupyterlab 3.6.5 (pip)
# bitsandbytes 0.41.2 (pip)
# cloudpickle 2.2.1 (pip)
# scikit-image 0.21.0 (pip)
# scikit-learn 1.3.0 (pip)
# matplotlib 3.7.3 (pip)
# ipywidgets 8.1.1 (pip)
# cython 3.0.2 (pip)
# tqdm 4.66.1 (pip)
# gdown 4.7.1 (pip)
# xgboost 1.7.6 (pip)
# pillow 9.5.0 (pip)
# seaborn 0.12.2 (pip)
# sqlalchemy 2.0.21 (pip)
# spacy 3.6.1 (pip)
# nltk 3.8.1 (pip)
# boto3 1.28.51 (pip)
# tabulate 0.9.0 (pip)
# future 0.18.3 (pip)
# jsonify 0.5 (pip)
# opencv-python 4.8.0.76 (pip)
# pyyaml 5.4.1 (pip)
# sentence-transformers 2.2.2 (pip)
# wandb 0.15.10 (pip)
# deepspeed 0.10.3 (pip)
# cupy-cuda12x 12.2.0 (pip)
# timm 0.9.7 (pip)
# omegaconf 2.3.0 (pip)
# scipy 1.11.2 (pip)
# gradient 2.0.6 (pip)
# attrs 23.1.0 (pip)
# default-jre latest (apt)
# default-jdk latest (apt)
# nodejs 20.x latest (apt)
# jupyter_contrib_nbextensions 0.7.0 (pip)
# jupyterlab-git 0.43.0 (pip)
# ==================================================================
# Initial setup
# ------------------------------------------------------------------
# Set ENV variables
export APT_INSTALL="apt-get install -y --no-install-recommends"
export PIP_INSTALL="python -m pip --no-cache-dir install --upgrade"
export GIT_CLONE="git clone --depth 10"
export DEBIAN_FRONTEND="noninteractive"
# Update apt
sudo apt update
# ==================================================================
# Tools
# ------------------------------------------------------------------
sudo $APT_INSTALL \
gcc \
make \
pkg-config \
apt-transport-https \
build-essential \
apt-utils \
ca-certificates \
wget \
rsync \
git \
vim \
mlocate \
libssl-dev \
curl \
openssh-client \
unzip \
unrar \
zip \
awscli \
csvkit \
emacs \
joe \
jq \
dialog \
man-db \
manpages \
manpages-dev \
manpages-posix \
manpages-posix-dev \
nano \
iputils-ping \
sudo \
ffmpeg \
libsm6 \
libxext6 \
libboost-all-dev \
gnupg \
cifs-utils \
zlib1g
# ==================================================================
# Git-lfs
# ------------------------------------------------------------------
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo $APT_INSTALL git-lfs gh
git config --global user.name "Joshua Gugun Siagian"
git config --global user.email joshua.siagian@binus.ac.id
git lfs install
# ==================================================================
# Python
# ------------------------------------------------------------------
# Based on https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
# Adding repository for python3.11
sudo $APT_INSTALL software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa -y
# Installing python3.11
sudo $APT_INSTALL \
python3.11 \
python3.11-dev \
python3.11-venv \
python3-distutils-extra
# Add symlink so python and python3 commands use same python3.11 executable
sudo ln -s /usr/bin/python3.11 /usr/local/bin/python3
sudo ln -s /usr/bin/python3.11 /usr/local/bin/python
# Grant access for pip to install in ~/.local
sudo chmod -R a+rwx /home/paperspace/.local
# Install pip
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
export PATH=$PATH:/home/paperspace/.local/bin
# ==================================================================
# Installing CUDA packages (CUDA Toolkit 12.1.1 & CUDNN 8.9.3)
# ------------------------------------------------------------------
# Based on https://developer.nvidia.com/cuda-toolkit-archive
# Based on https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
# sudo $APT_INSTALL nvidia-driver-535=535.216.03-0ubuntu1 \
# nvidia-fabricmanager-535=535.216.03-0ubuntu0.22.04.1 \
# cuda-drivers=535.216.03-1 \
# nvtop nvidia-modprobe=535.216.03-0ubuntu1 \
# nvidia-settings=535.216.03-0ubuntu1 \
# libnvidia-egl-wayland1 \
# cuda=12.1.1-1 \
# cuda-toolkit-12-config-common=12.1.105-1 \
# cuda-toolkit-config-common=12.1.105-1 \
# libnvidia-container-tools=1.13.2-1 \
# libnvidia-container1=1.13.2-1 \
# nvidia-container-toolkit=1.13.2-1 \
# nvidia-container-toolkit-base=1.13.2-1 \
# libnccl-dev=2.18.3-1+cuda12.1 \
# libnccl2=2.18.3-1+cuda12.1 \
# libxnvctrl0=535.216.03-0ubuntu1 \
# libcudnn8=8.9.3.28-1+cuda12.1 \
# libcudnn8-dev=8.9.3.28-1+cuda12.1
# export PATH=$PATH:/usr/local/cuda/bin
# export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# export CUDA_HOME=/usr/local/cuda
# ==================================================================
# Installing CUDA packages (CUDA Toolkit 12.2.2 & CUDNN 8.9.4)
# ------------------------------------------------------------------
# Based on https://developer.nvidia.com/cuda-toolkit-archive
# Based on https://developer.nvidia.com/rdp/cudnn-archive
# wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run
# sudo sh cuda_12.2.2_535.104.05_linux.run --silent --toolkit
# export PATH=$PATH:/usr/local/cuda-12.2/bin
# export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64
# rm cuda_12.2.2_535.104.05_linux.run
# wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
# sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
# sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
# sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
# sudo $APT_INSTALL libcudnn8=8.9.4.*-1+cuda12.2
# sudo $APT_INSTALL libcudnn8-dev=8.9.4.*-1+cuda12.2
# ==================================================================
# Installing CUDA packages (CUDA Toolkit 12.1.1 & CUDNN 8.9.3)
# ------------------------------------------------------------------
# https://developer.nvidia.com/cuda-downloads
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo $APT_INSTALL cuda-toolkit-12-6
export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
rm cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo $APT_INSTALL cudnn9-cuda-12
sudo apt-get install -y nvidia-open nvidia-fabricmanager
# https://askubuntu.com/a/1258909/826952
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
# ==================================================================
# PyTorch
# ------------------------------------------------------------------
# # Based on https://pytorch.org/get-started/locally/
# $PIP_INSTALL torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1
# ==================================================================
# TensorFlow
# ------------------------------------------------------------------
# # Based on https://www.tensorflow.org/install/pip
# $PIP_INSTALL tensorflow==2.15.0
# ==================================================================
# Hugging Face Libraries
# ------------------------------------------------------------------
# $PIP_INSTALL transformers==4.35.2 \
# datasets==2.14.5 \
# peft==0.6.2 \
# tokenizers==0.13.3 \
# accelerate==0.24.1 \
# diffusers==0.21.4 \
# safetensors==0.4.0
# ==================================================================
# JupyterLab
# ------------------------------------------------------------------
# Based on https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html#pip
# $PIP_INSTALL jupyterlab==3.6.5
# ==================================================================
# Additional Python Packages
# ------------------------------------------------------------------
# $PIP_INSTALL \
# bitsandbytes==0.41.2 \
# cloudpickle==2.2.1 \
# scikit-image==0.21.0 \
# scikit-learn==1.3.0 \
# matplotlib==3.7.3 \
# ipywidgets==8.1.1 \
# cython==3.0.2 \
# tqdm==4.66.1 \
# gdown==4.7.1 \
# xgboost==1.7.6 \
# pillow==9.5.0 \
# seaborn==0.12.2 \
# sqlalchemy==2.0.21 \
# spacy==3.6.1 \
# nltk==3.8.1 \
# boto3==1.28.51 \
# tabulate==0.9.0 \
# future==0.18.3 \
# jsonify==0.5 \
# opencv-python==4.8.0.76 \
# pyyaml==5.4.1 \
# sentence-transformers==2.2.2 \
# wandb==0.15.10 \
# deepspeed==0.10.3 \
# cupy-cuda12x==12.2.0 \
# timm==0.9.7 \
# omegaconf==2.3.0 \
# scipy==1.11.2 \
# gradient==2.0.6
# $PIP_INSTALL attrs==23.1.0
# ==================================================================
# Installing JRE and JDK
# ------------------------------------------------------------------
sudo $APT_INSTALL default-jre
sudo $APT_INSTALL default-jdk
# ==================================================================
# CMake
# ------------------------------------------------------------------
# sudo $GIT_CLONE https://github.com/Kitware/CMake ~/cmake
# cd ~/cmake
# sudo ./bootstrap
# sudo make -j"$(nproc)" install
# ==================================================================
# Node.js and Jupyter Notebook Extensions
# ------------------------------------------------------------------
# Node.js
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
export NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo $APT_INSTALL nodejs
# Jupyter Notebook Extensions
# $PIP_INSTALL jupyter_contrib_nbextensions==0.7.0 jupyterlab-git==0.43.0
# jupyter contrib nbextension install --user
# ==================================================================
# astral uv
# ------------------------------------------------------------------
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
# echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc
# echo 'eval "$(uvx --generate-shell-completion bash)"' >> ~/.bashrc
# ==================================================================
# Config & Cleanup
# ------------------------------------------------------------------
echo "export PATH=${PATH}" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> ~/.bashrc
echo "export CUDA_HOME=${CUDA_HOME}" >> ~/.bashrc
# ==================================================================
# Finalize
# ------------------------------------------------------------------
# Cleanup
sudo apt autoremove -y
sudo updatedb
# Reboot
sudo reboot
# ==================================================================
# What's next?
# ------------------------------------------------------------------
# do `gh auth login`