Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·54 lines (44 loc) · 1.68 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·54 lines (44 loc) · 1.68 KB
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
#!/bin/bash
# Set up the development environment.
#
# Works on the remote Ubuntu instances (installs CUDA + toolchain) and on
# macOS / other systems (python environment only).
#
# Usage:
# bash setup.sh
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${REPO_DIR}"
OS="$(uname -s)"
echo Install uv and uv packages
if ! command -v uv >/dev/null 2>&1; then
# Prefer pip; on PEP 668 "externally-managed" Pythons (e.g. Homebrew)
# fall back to the standalone installer, which needs no Python at all.
pip install --only-binary ':all:' uv || {
curl --proto '=https' --tlsv1.2 -LsSf https://astral.sh/uv/install.sh | sh
export PATH="${HOME}/.local/bin:${PATH}"
}
fi
uv venv
uv sync --python 3.12
if [ "${OS}" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then
export CUDA_HOME=/usr/local/cuda
echo Install cuda
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-get -y install cuda-toolkit-12-4
echo Setup toolchain
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get dist-upgrade -y
else
echo "Skipping CUDA and toolchain install (Ubuntu/Debian only, detected ${OS})."
fi
# shellcheck disable=SC1091
source "${REPO_DIR}/.venv/bin/activate"
python -m ipykernel install --user --name s4casting --display-name "Python (s4casting)"
# Install nbstripout to strip output from notebooks on git commits
uv run nbstripout --install
bash "${REPO_DIR}/data/get_data.sh"