Skip to content

Commit

Permalink
Fix IE Python API search inside MO for Windows platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleb Kazantaev committed May 27, 2021
1 parent 5b8b214 commit f68066b
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions model-optimizer/mo/utils/find_ie_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,47 @@ def find_ie_version(silent=False):
python_version = 'python{}.{}'.format(sys.version_info[0], sys.version_info[1])

script_path = os.path.realpath(os.path.dirname(__file__))
bindings_paths = [
# Windows

# Windows
bindings_paths_windows = [
# Package
{
"module": os.path.join(script_path, '../../../../python/', python_version),
"libs": [
os.path.join(script_path, '../../../inference_engine/bin/intel64/Release'),
os.path.join(script_path, '../../../inference_engine/external/tbb/bin'),
os.path.join(script_path, '../../../ngraph/lib'),
],
"condition": lambda: sys.platform == "windows"
},
# Linux / Darwin
# Local builds
{
"module": os.path.join(script_path, '../../../bin/intel64/Release/python_api/', python_version),
"libs": [
os.path.join(script_path, '../../../bin/intel64'),
os.path.join(script_path, '../../../bin/intel64/Release'),
os.path.join(script_path, '../../../inference-engine/temp/tbb/bin'),
]
},
{
"module": os.path.join(script_path, '../../../bin/intel64/Debug/python_api/', python_version),
"libs": [
os.path.join(script_path, '../../../bin/intel64'),
os.path.join(script_path, '../../../bin/intel64/Debug'),
os.path.join(script_path, '../../../inference-engine/temp/tbb/bin'),
]
},
]

# Linux / Darwin
bindings_paths_linux = [
# Package
{
"module": os.path.join(script_path, '../../../../python/', python_version),
"libs": [
os.path.join(script_path, '../../../inference_engine/lib/intel64'),
os.path.join(script_path, '../../../inference_engine/external/tbb/lib'),
os.path.join(script_path, '../../../ngraph/lib'),
],
"condition": lambda: sys.platform != "windows"
},
# Local builds
{
Expand All @@ -109,6 +130,7 @@ def find_ie_version(silent=False):
os.path.join(script_path, '../../../bin/intel64/Release/lib'),
]
},

{
"module": os.path.join(script_path, '../../../bin/intel64/RelWithDebInfo/lib/python_api/', python_version),
"libs": [
Expand All @@ -123,12 +145,11 @@ def find_ie_version(silent=False):
}
]

bindings_paths = bindings_paths_windows if platform.system() == "Windows" else bindings_paths_linux
for item in bindings_paths:
module = item['module']
if not os.path.exists(module):
continue
if "condition" in item and not item["condition"]():
continue
if try_to_import_ie(module=os.path.normpath(module), libs=item['libs'] if 'libs' in item else [], silent=silent):
return True

Expand Down

0 comments on commit f68066b

Please sign in to comment.