-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_env.sh
More file actions
executable file
·38 lines (34 loc) · 1.54 KB
/
Copy pathsetup_env.sh
File metadata and controls
executable file
·38 lines (34 loc) · 1.54 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
#!/bin/bash
# One-time environment setup on Snellius (run from the repo root on a login node):
# bash slurm/setup_env.sh
# Creates a lean compute venv (.venv) with the model + SALib. Re-run after
# dependency changes.
set -euo pipefail
module purge
module load 2023
module load Python/3.11.3-GCCcore-12.3.0
# Always start from a clean venv. A half-built .venv from an interrupted run
# leaves read-only files that make `python -m venv` fail with EACCES on
# activate.csh; wiping first makes re-runs idempotent.
chmod -R u+w .venv 2>/dev/null || true
rm -rf .venv
python -m venv --clear .venv
source .venv/bin/activate
pip install --upgrade pip wheel
# Lean compute env: mesa[network] gives networkx (mesa.discrete_space imports it
# unconditionally) but skips the [viz] solara/altair stack the SA never uses
# (viz.py is never imported by the SA path). Then install our package without
# re-resolving, so the heavy viz extra is not pulled back in.
pip install "mesa[network]>=3.0,<4.0" "numpy>=1.26" "pandas>=2.0" "matplotlib>=3.7" "SALib>=1.5"
pip install -e . --no-deps
# Smoke-test the exact imports the SA scripts use.
python - <<'PY'
import mesa, numpy, pandas, matplotlib
from importlib.metadata import version
from SALib.sample import sobol # noqa: F401
from SALib.analyze import sobol as _ # noqa: F401
from spatial_market_lockin import SpatialMarketModel # noqa: F401
print(f"mesa {mesa.__version__} | SALib {version('SALib')} | "
f"matplotlib {matplotlib.__version__} | imports OK")
PY
echo "Environment ready. Submit jobs with: sbatch slurm/sa_ofat.sh"