Unverified Commit 7d2de404 authored by Andrey Talman's avatar Andrey Talman Committed by GitHub
Browse files

Fix windows python 3.8 required dlls not found (#6715)



* Fix windows python 3.8

* Update torchvision/extension.py
Co-authored-by: default avatarVasilis Vryniotis <datumbox@users.noreply.github.com>

* Update torchvision/extension.py
Co-authored-by: default avatarVasilis Vryniotis <datumbox@users.noreply.github.com>
parent 61034d53
...@@ -16,6 +16,18 @@ def _has_ops(): ...@@ -16,6 +16,18 @@ def _has_ops():
try: try:
# On Windows Python-3.8.x has `os.add_dll_directory` call,
# which is called to configure dll search path.
# To find cuda related dlls we need to make sure the
# conda environment/bin path is configured Please take a look:
# https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python
if os.name == "nt" and sys.version_info >= (3, 8) and sys.version_info < (3, 9):
env_path = os.environ["PATH"]
path_arr = env_path.split(";")
for path in path_arr:
if os.path.exists(path):
os.add_dll_directory(path) # type: ignore[attr-defined]
lib_path = _get_extension_path("_C") lib_path = _get_extension_path("_C")
torch.ops.load_library(lib_path) torch.ops.load_library(lib_path)
_HAS_OPS = True _HAS_OPS = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment