From 2cd0207026e262e74fccef1cfdb86ad8795c68e3 Mon Sep 17 00:00:00 2001 From: zhou-haitao <1300182097@qq.com> Date: Mon, 15 Dec 2025 14:55:02 +0800 Subject: [PATCH 1/2] Add PLATFORM reminder --- setup.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/setup.py b/setup.py index e2a4b77f..9dd5a080 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ # SOFTWARE. # +import atexit import os import subprocess import sys @@ -34,6 +35,37 @@ ENABLE_SPARSE = os.getenv("ENABLE_SPARSE") +_warning_printed = False + + +def print_platform_warning(): + global _warning_printed + if not PLATFORM and not _warning_printed: + _warning_printed = True + RED = "\033[91m" + YELLOW = "\033[93m" + BOLD = "\033[1m" + RESET = "\033[0m" + + warning_msg = f""" +{RED}{'=' * 80} +{BOLD}⚠️ WARNING: PLATFORM environment variable is not set! ⚠️{RESET} +{RED}{'=' * 80}{RESET} +{YELLOW}Please set PLATFORM to one of: cuda, ascend, musa, maca{RESET} +Example: + {BOLD}export PLATFORM=cuda{RESET} # For CUDA platform +{YELLOW}Please uninstall first, then select the PLATFORM, and reinstall.{RESET} +{RED}{'=' * 80}{RESET} +""" + # Use write and flush to ensure output even without -v flag + sys.stderr.write(warning_msg) + sys.stderr.flush() + + +if not PLATFORM: + atexit.register(print_platform_warning) + + def enable_sparse() -> bool: return ENABLE_SPARSE is not None and ENABLE_SPARSE.lower() == "true" From 5a6cbd054c62b40609b2cbb5cc326dae24adaeea Mon Sep 17 00:00:00 2001 From: zhou-haitao <1300182097@qq.com> Date: Tue, 16 Dec 2025 10:21:06 +0800 Subject: [PATCH 2/2] Add PLATFORM reminder --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9dd5a080..c30a1078 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def print_platform_warning(): {YELLOW}Please set PLATFORM to one of: cuda, ascend, musa, maca{RESET} Example: {BOLD}export PLATFORM=cuda{RESET} # For CUDA platform -{YELLOW}Please uninstall first, then select the PLATFORM, and reinstall.{RESET} +{YELLOW}In CI scenarios only, you don't need to specify PLATFORM. If it's not a CI scenario, please uninstall and then reinstall with PLATFORM specified.{RESET} {RED}{'=' * 80}{RESET} """ # Use write and flush to ensure output even without -v flag