From 71d3577961fa2fd5010b1f3f8c449b4947986eac Mon Sep 17 00:00:00 2001 From: egillax Date: Fri, 1 Nov 2024 14:13:22 +0100 Subject: [PATCH] try to detect macOS --- .github/workflows/R_CDM_check_hades.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/R_CDM_check_hades.yaml b/.github/workflows/R_CDM_check_hades.yaml index 2addc69..6fd55c4 100644 --- a/.github/workflows/R_CDM_check_hades.yaml +++ b/.github/workflows/R_CDM_check_hades.yaml @@ -79,6 +79,14 @@ jobs: library(reticulate) virtualenv_create("r-reticulate", Sys.which("python"), packages=python_packages) + # Detect the OS and set pip options accordingly + if (Sys.info()["sysname"] == "Darwin") { + # macOS + pip_options <- NULL + } else { + # Other OS, assume Linux or Windows needing CPU torch + pip_options <- c("--index-url https://download.pytorch.org/whl/cpu") + } virtualenv_install("r-reticulate", "torch", pip_options = c("--index-url https://download.pytorch.org/whl/cpu")) path_to_python <- virtualenv_python("r-reticulate")