From 635f2c0f708a868eb2286b9fb64fec43cd136c32 Mon Sep 17 00:00:00 2001 From: Akshay Ballal Date: Mon, 11 Nov 2024 11:16:18 +0100 Subject: [PATCH] fix windows --- Cargo.lock | 2 +- python/Cargo.toml | 2 +- python/python/embed_anything/__init__.py | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index afeee5a..a66368c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -965,7 +965,7 @@ dependencies = [ [[package]] name = "embed_anything_python" -version = "0.4.14" +version = "0.4.15" dependencies = [ "embed_anything", "pyo3", diff --git a/python/Cargo.toml b/python/Cargo.toml index 6ec8054..dfd563e 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "embed_anything_python" -version = "0.4.14" +version = "0.4.15" edition = "2021" [lib] diff --git a/python/python/embed_anything/__init__.py b/python/python/embed_anything/__init__.py index 9770cb5..4ce0700 100644 --- a/python/python/embed_anything/__init__.py +++ b/python/python/embed_anything/__init__.py @@ -120,6 +120,7 @@ """ from ._embed_anything import * from .vectordb import * +import platform import os import onnxruntime import glob @@ -128,11 +129,19 @@ if path is None: print("onnxruntime is not installed. Install it using `pip install onnxruntime`") - else: - dylib_path = glob.glob(os.path.join(path, "libonnxruntime.so*")) - os.environ["ORT_DYLIB_PATH"] = dylib_path[0] + if platform.system() == "Windows": + # For Windows, look for DLL files + dylib_path = glob.glob(os.path.join(path, "onnxruntime.dll")) + else: + # For Linux, look for shared object files + dylib_path = glob.glob(os.path.join(path, "libonnxruntime.so*")) + + if dylib_path: + os.environ["ORT_DYLIB_PATH"] = dylib_path[0] + else: + print("onnxruntime dynamic library not found.") __doc__ = _embed_anything.__doc__ if hasattr(_embed_anything, "__all__"): - __all__ = _embed_anything.__all__ + __all__ = _embed_anything.__all__ \ No newline at end of file