Skip to content

Commit

Permalink
Fix windows python 3.8 loading path (#2747)
Browse files Browse the repository at this point in the history
Summary:
Fix windows python 3.8 loading path

Pull Request resolved: #2747

Reviewed By: nateanl

Differential Revision: D40264326

Pulled By: nateanl

fbshipit-source-id: f4a24757de7b48c63a7481034eb11fc3ff174327
  • Loading branch information
atalman authored and facebook-github-bot committed Oct 11, 2022
1 parent 8418790 commit c38229d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion torchaudio/_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ def _init_extension():
# 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
# Please note: if some path can't be added using add_dll_directory we simply ignore this path
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)
try:
os.add_dll_directory(path)
except Exception:
pass

_load_lib("libtorchaudio")
# This import is for initializing the methods registered via PyBind11
Expand Down

0 comments on commit c38229d

Please sign in to comment.