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")