Skip to content

Commit 2b603c2

Browse files
committed
Revert "Fix load_torchcodec_shared_libraries on Windows (#1109)"
This reverts commit 79f985a.
1 parent 51f57d7 commit 2b603c2

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/torchcodec/_core/ops.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66

77
import io
88
import json
9-
import os
10-
import shutil
11-
import sys
129
import warnings
13-
from contextlib import nullcontext
14-
from pathlib import Path
1510
from types import ModuleType
1611
from typing import List, Optional, Tuple, Union
1712

@@ -27,7 +22,7 @@
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

Comments
 (0)