66
77import io
88import json
9- import os
10- import shutil
11- import sys
129import warnings
13- from contextlib import nullcontext
14- from pathlib import Path
1510from types import ModuleType
1611from typing import List , Optional , Tuple , Union
1712
2722_pybind_ops : Optional [ModuleType ] = None
2823
2924
30- def load_torchcodec_shared_libraries () -> tuple [ int , str ] :
25+ def load_torchcodec_shared_libraries ():
3126 # Successively try to load the shared libraries for each version of FFmpeg
3227 # that we support. We always start with the highest version, working our way
3328 # down to the lowest version. Once we can load ALL shared libraries for a
@@ -75,8 +70,7 @@ def load_torchcodec_shared_libraries() -> tuple[int, str]:
7570 raise RuntimeError (
7671 f"""Could not load libtorchcodec. Likely causes:
7772 1. FFmpeg is not properly installed in your environment. We support
78- versions 4, 5, 6, 7, and 8. On Windows, ensure you've installed
79- the "full-shared" version which ships DLLs.
73+ versions 4, 5, 6, 7, and 8.
8074 2. The PyTorch version ({ torch .__version__ } ) is not compatible with
8175 this version of TorchCodec. Refer to the version compatibility
8276 table:
@@ -88,21 +82,7 @@ def load_torchcodec_shared_libraries() -> tuple[int, str]:
8882 )
8983
9084
91- if sys .platform == "win32" and hasattr (os , "add_dll_directory" ):
92- # On windows we try to locate the FFmpeg DLLs and temporarily add them to
93- # the DLL search path. This seems to be needed on some users machine, but
94- # not on our CI. We don't know why.
95- if ffmpeg_path := shutil .which ("ffmpeg" ):
96-
97- def cm (): # noqa: F811
98- ffmpeg_dir = Path (ffmpeg_path ).parent
99- return os .add_dll_directory (str (ffmpeg_dir )) # that's the actual CM
100-
101- else :
102- cm = nullcontext
103-
104- with cm ():
105- ffmpeg_major_version , core_library_path = load_torchcodec_shared_libraries ()
85+ ffmpeg_major_version , core_library_path = load_torchcodec_shared_libraries ()
10686
10787
10888# Note: We use disallow_in_graph because PyTorch does constant propagation of
0 commit comments