From 31bb879445511edddfbfe3093928b1bc52461049 Mon Sep 17 00:00:00 2001 From: Dax Eckenberg Date: Tue, 5 Aug 2025 18:00:50 -0700 Subject: [PATCH] Update __init__.py - fix for .pyd libraries not loading In the ComfyUI project , and other projects which are dependent on pytorch/audio, there's a failure to load ffmpeg support due to failures when attempting to load libtorio libraries. Namely any of the following.... site-packages\torio\lib\libtorio_ffmpeg4.pyd site-packages\torio\lib\libtorio_ffmpeg5.pyd site-packages\torio\lib\libtorio_ffmpeg6.pyd These fail to load as they can't find the other system shared DLLs required by these .pyd libraries. Allowing for _init_dll_path() on Python versions above 3.9 allows the .pyd libraries to find their shared libraries and fixes this issue. This could be a kludge, but it works. I'd almost consider getting rid of the upper bounds test, but keeping it seems appropriate. --- src/torchaudio/_extension/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/torchaudio/_extension/__init__.py b/src/torchaudio/_extension/__init__.py index 5c2ff55583..42ff67d496 100644 --- a/src/torchaudio/_extension/__init__.py +++ b/src/torchaudio/_extension/__init__.py @@ -21,7 +21,7 @@ ] -if os.name == "nt" and (3, 8) <= sys.version_info < (3, 9): +if os.name == "nt" and (3, 8) <= sys.version_info < (3, 99): _init_dll_path()