You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install.sh 1.3KB

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # install.sh – minimal Conda bootstrap with ~/.bashrc check
  3. set -e
  4. ENV=kg-env # must match your environment.yml
  5. YAML=kg_env.yaml # assumed to be in the current dir
  6. # ── 1. try to load an existing conda from ~/.bashrc ──────────────────────
  7. [ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc" || true
  8. # ── 2. ensure conda exists ───────────────────────────────────────────────
  9. if ! command -v conda &>/dev/null; then
  10. echo "[install.sh] Conda not found → installing Miniconda."
  11. curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh
  12. bash miniconda.sh -b -p "$HOME/miniconda3"
  13. rm miniconda.sh
  14. source "$HOME/miniconda3/etc/profile.d/conda.sh"
  15. conda init bash >/dev/null # so future shells have it
  16. else
  17. # conda exists; load its helper for this shell
  18. source "$(conda info --base)/etc/profile.d/conda.sh"
  19. fi
  20. # ── 3. create or update the project env ──────────────────────────────────
  21. conda env create -n "$ENV" -f "$YAML" \
  22. || conda env update -n "$ENV" -f "$YAML" --prune
  23. echo "✔ Done. Activate with: conda activate $ENV"