mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-05 04:17:53 +00:00
[python API] Change raise import error when C:\Windows\System32\vcruntime140_1.dll is not found to warning (#10927)
* remove throw if C:\\Windows\\System32\\vcruntime140_1.dll cannot be found * Add comments and update warning message * adding back accidentally removed line Co-authored-by: gwang0000 <62914304+gwang0000@users.noreply.github.com>
This commit is contained in:
parent
740870a285
commit
b86d105153
1 changed files with 8 additions and 2 deletions
|
|
@ -8,16 +8,22 @@ Ensure that dependencies are available and then load the extension module.
|
|||
import os
|
||||
import platform
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from . import _ld_preload # noqa: F401
|
||||
|
||||
if platform.system() == "Windows":
|
||||
from . import version_info
|
||||
|
||||
# If on Windows, check if this import error is caused by the user not installing the 2019 VC Runtime
|
||||
# The VC Redist installer usually puts the VC Runtime dlls in the System32 folder, but it may also be found
|
||||
# in some other locations or in some case Windows is not installed at C:\Windows.
|
||||
# TODO, we may want to try to load the VC Runtime dlls instead of checking if the hardcoded file path
|
||||
# is valid, and raise ImportError if the load fails
|
||||
if version_info.vs2019 and platform.architecture()[0] == "64bit":
|
||||
if not os.path.isfile("C:\\Windows\\System32\\vcruntime140_1.dll"):
|
||||
raise ImportError(
|
||||
"Microsoft Visual C++ Redistributable for Visual Studio 2019 not installed on the machine.")
|
||||
warnings.warn("Please install the 2019 Visual C++ runtime and then try again")
|
||||
|
||||
@ONNXRUNTIME_SETDLOPENFLAGS_GLOBAL@
|
||||
from .onnxruntime_pybind11_state import * # noqa
|
||||
@ONNXRUNTIME_SETDLOPENFLAGS_LOCAL@
|
||||
|
|
|
|||
Loading…
Reference in a new issue