Skip to content

Commit

Permalink
Fix _add_openvino_libs_to_search_path
Browse files Browse the repository at this point in the history
Signed-off-by: Alicja Miloszewska <[email protected]>
  • Loading branch information
almilosz committed Dec 13, 2024
1 parent e3dfef4 commit bf4244c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/bindings/python/src/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
from openvino.package_utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def _add_openvino_libs_to_search_path() -> None:
# If you're using a custom installation of openvino,
# add the location of openvino dlls to your system PATH.
openvino_libs = []
if os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, "libs")):
if os.path.isdir(os.path.join(os.path.dirname(__file__), "libs")):
# looking for the libs in the pip installation path.
openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, "libs"))
elif os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "Library", "bin")):
openvino_libs.append(os.path.join(os.path.dirname(__file__), "libs"))
elif os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "Library", "bin")):
# looking for the libs in the conda installation path
openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "Library", "bin"))
openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "Library", "bin"))
else:
# setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable.
openvino_libs_installer = os.getenv("OPENVINO_LIB_PATHS")
Expand All @@ -33,7 +33,7 @@ def _add_openvino_libs_to_search_path() -> None:
sys.exit("Error: Please set the OPENVINO_LIB_PATHS environment variable. "
"If you use an install package, please, run setupvars.bat")
for lib in openvino_libs:
lib_path = os.path.join(os.path.dirname(__file__), os.pardir, lib)
lib_path = os.path.join(os.path.dirname(__file__), lib)
if os.path.isdir(lib_path):
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
os.add_dll_directory(os.path.abspath(lib_path))
Expand All @@ -45,7 +45,7 @@ def get_cmake_path() -> str:
:return: The path to the directory containing CMake files, if found. Otherwise, returns empty string.
:rtype: str
"""
package_path = Path(__file__).parent.parent
package_path = Path(__file__).parent
cmake_file = "OpenVINOConfig.cmake"

for dirpath, _, filenames in os.walk(package_path):
Expand Down
10 changes: 4 additions & 6 deletions src/bindings/python/src/openvino/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

from openvino._pyopenvino.util import numpy_to_c, replace_node, replace_output_update_name

from openvino.utils.package_utils import _add_openvino_libs_to_search_path
from openvino.utils.package_utils import get_cmake_path
from openvino.utils.package_utils import deprecated
from openvino.utils.package_utils import _ClassPropertyDescriptor
from openvino.utils.package_utils import classproperty
from openvino.utils.package_utils import deprecatedclassproperty
from openvino.package_utils import get_cmake_path
from openvino.package_utils import deprecated
from openvino.package_utils import classproperty
from openvino.package_utils import deprecatedclassproperty
2 changes: 1 addition & 1 deletion tools/benchmark_tool/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
from openvino.package_utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion tools/ovc/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
from openvino.package_utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
Expand Down

0 comments on commit bf4244c

Please sign in to comment.