diff --git a/learnware/config.py b/learnware/config.py index 094dc2c..02f3bcb 100644 --- a/learnware/config.py +++ b/learnware/config.py @@ -55,13 +55,12 @@ class SystemType(Enum): def get_platform(): import platform - - sys_platform = platform.platform().lower() - if "windows" in sys_platform: - return SystemType.WINDOWS - elif "macos" in sys_platform: + os_name = platform.system().lower() + if "macos" in os_name or "darwin" in os_name: return SystemType.MACOS - elif "linux" in sys_platform: + elif "windows" in os_name: + return SystemType.WINDOWS + elif "linux" in os_name: return SystemType.LINUX raise SystemError("Learnware only support MACOS/Linux/Windows") diff --git a/setup.py b/setup.py index 1992bdc..ebf8e99 100644 --- a/setup.py +++ b/setup.py @@ -29,23 +29,6 @@ VERSION = get_version("learnware/__init__.py") if os.path.exists("MANIFEST"): os.remove("MANIFEST") -class SystemType(Enum): - LINUX = 0 - MACOS = 1 - WINDOWS = 2 - -def get_platform(): - import platform - - sys_platform = platform.platform().lower() - if "windows" in sys_platform: - return SystemType.WINDOWS - elif "macos" in sys_platform: - return SystemType.MACOS - elif "linux" in sys_platform: - return SystemType.LINUX - raise SystemError("Learnware only support MACOS/Linux/Windows") - # What packages are required for this module to be executed? # `estimator` may depend on other packages. In order to reduce dependencies, it is not written here. @@ -92,14 +75,11 @@ FULL_REQUIRED = [ "torch==2.0.1", "torchvision==0.15.2", "torch-optimizer>=0.3.0", + "lightgbm>=3.3.0", "sentence_transformers==2.2.2", "fast_pytorch_kmeans==0.2.0.1", ] -# In MACOS, the lightgbm package should be installed with brew. -if get_platform() != SystemType.MACOS: - FULL_REQUIRED += ["lightgbm>=3.3.0"] - here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read()