From 370e470f2e3debdd2948f894c2299ce7095861aa Mon Sep 17 00:00:00 2001 From: sssshhhhhh <193317444+sssshhhhhh@users.noreply.github.com> Date: Wed, 4 Feb 2026 06:48:38 +1100 Subject: [PATCH 1/3] Fix windows --- .github/workflows/ci.yml | 4 ++++ python/ctranslate2/__init__.py | 22 +++++++--------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 163249f99..cadac5c9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -278,6 +278,10 @@ jobs: artifact_pattern: python-wheels-Linux-aarch64 wheel_pattern: "*cp310*manylinux*_aarch64.whl" + - os: windows-2022 + artifact_pattern: python-wheels-Windows-auto64 + wheel_pattern: "*cp310*win*amd64.whl" + - os: macos-15 artifact_pattern: python-wheels-macOS-arm64 wheel_pattern: "*cp310*macosx*arm64.whl" diff --git a/python/ctranslate2/__init__.py b/python/ctranslate2/__init__.py index 849f1516a..53f0e9f7f 100644 --- a/python/ctranslate2/__init__.py +++ b/python/ctranslate2/__init__.py @@ -4,25 +4,17 @@ import ctypes import glob import os + from importlib.resources import files module_name = sys.modules[__name__].__name__ + package_dir = str(files(module_name)) - # Adressing python 3.9 < version try: - from importlib.resources import files - - # Fixed the pkg_resources depreciation - package_dir = str(files(module_name)) - except ImportError: - import pkg_resources - - package_dir = pkg_resources.resource_filename(module_name, "") - - add_dll_directory = getattr(os, "add_dll_directory", None) - if add_dll_directory is not None: - add_dll_directory(package_dir) - add_dll_directory(f"{package_dir}/../_rocm_sdk_core/bin") - add_dll_directory(f"{package_dir}/../_rocm_sdk_libraries_custom/bin") + os.add_dll_directory(package_dir) + os.add_dll_directory(f"{package_dir}/../_rocm_sdk_core/bin") + os.add_dll_directory(f"{package_dir}/../_rocm_sdk_libraries_custom/bin") + except FileNotFoundError | OSError: + pass for library in glob.glob(os.path.join(package_dir, "*.dll")): ctypes.CDLL(library) From 5bd8a4b7038721ee81be8706bedb3d0d5904a6cb Mon Sep 17 00:00:00 2001 From: sssshhhhhh <193317444+sssshhhhhh@users.noreply.github.com> Date: Wed, 4 Feb 2026 06:54:20 +1100 Subject: [PATCH 2/3] Update __init__.py --- python/ctranslate2/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/ctranslate2/__init__.py b/python/ctranslate2/__init__.py index 53f0e9f7f..6b05d1412 100644 --- a/python/ctranslate2/__init__.py +++ b/python/ctranslate2/__init__.py @@ -4,6 +4,7 @@ import ctypes import glob import os + from importlib.resources import files module_name = sys.modules[__name__].__name__ From 30ffb235a8e2e4206b2a0e6fd72b61ca4125e175 Mon Sep 17 00:00:00 2001 From: sssshhhhhh <193317444+sssshhhhhh@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:15:27 +1100 Subject: [PATCH 3/3] Update __init__.py --- python/ctranslate2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctranslate2/__init__.py b/python/ctranslate2/__init__.py index 6b05d1412..1b0e1aa0e 100644 --- a/python/ctranslate2/__init__.py +++ b/python/ctranslate2/__init__.py @@ -14,7 +14,7 @@ os.add_dll_directory(package_dir) os.add_dll_directory(f"{package_dir}/../_rocm_sdk_core/bin") os.add_dll_directory(f"{package_dir}/../_rocm_sdk_libraries_custom/bin") - except FileNotFoundError | OSError: + except (FileNotFoundError, OSError): pass for library in glob.glob(os.path.join(package_dir, "*.dll")):