Provide a working Dockerfile. Any local install with the install instructions is unreliable and crashes.
As the title suggests. Currently installing torchcodec is plagued with nasty ffmpeg issues that are not easily resolved.
Resolving to hacks and unreliable custom setups seems counterproductive. I have spent about two hours now attempting to install just this one package on Windows and on Linux.
File "/app/.venv/lib/python3.10/site-packages/torchcodec/_internally_replaced_utils.py", line 111, in load_torchcodec_shared_libraries
raise RuntimeError(
RuntimeError: Could not load libtorchcodec. Likely causes:
1. FFmpeg is not properly installed in your environment. We support
versions 4, 5, 6, 7, and 8, and we attempt to load libtorchcodec
for each of those versions. Errors for versions not installed on
your system are expected; only the error for your installed FFmpeg
version is relevant. On Windows, ensure you've installed the
"full-shared" version which ships DLLs.
2. The PyTorch version (2.10.0+cu128) is not compatible with
this version of TorchCodec. Refer to the version compatibility
table:
https://github.com/pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec.
3. Another runtime dependency; see exceptions below.
The following exceptions were raised as we tried to load libtorchcodec:
[start of libtorchcodec loading traceback]
FFmpeg version 8:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1442, in load_library
ctypes.CDLL(path)
File "/opt/conda/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /app/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core8.so: undefined symbol: torch_dtype_float4_e2m1fn_x2
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torchcodec/_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries
torch.ops.load_library(core_library_path)
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1444, in load_library
raise OSError(f"Could not load this library: {path}") from e
OSError: Could not load this library: /app/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core8.so
FFmpeg version 7:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1442, in load_library
ctypes.CDLL(path)
File "/opt/conda/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libavutil.so.59: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torchcodec/_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries
torch.ops.load_library(core_library_path)
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1444, in load_library
raise OSError(f"Could not load this library: {path}") from e
OSError: Could not load this library: /app/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core7.so
FFmpeg version 6:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1442, in load_library
ctypes.CDLL(path)
File "/opt/conda/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libavutil.so.58: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torchcodec/_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries
torch.ops.load_library(core_library_path)
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1444, in load_library
raise OSError(f"Could not load this library: {path}") from e
OSError: Could not load this library: /app/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core6.so
FFmpeg version 5:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1442, in load_library
ctypes.CDLL(path)
File "/opt/conda/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libavutil.so.57: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torchcodec/_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries
torch.ops.load_library(core_library_path)
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1444, in load_library
raise OSError(f"Could not load this library: {path}") from e
OSError: Could not load this library: /app/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core5.so
FFmpeg version 4:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1442, in load_library
ctypes.CDLL(path)
File "/opt/conda/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libavutil.so.56: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/torchcodec/_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries
torch.ops.load_library(core_library_path)
File "/app/.venv/lib/python3.10/site-packages/torch/_ops.py", line 1444, in load_library
raise OSError(f"Could not load this library: {path}") from e
OSError: Could not load this library: /app/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core4.so
[end of libtorchcodec loading traceback].
🚀 The feature
Provide a working Dockerfile. Any local install with the install instructions is unreliable and crashes.
Motivation, pitch
As the title suggests. Currently installing torchcodec is plagued with nasty ffmpeg issues that are not easily resolved.
Resolving to hacks and unreliable custom setups seems counterproductive. I have spent about two hours now attempting to install just this one package on Windows and on Linux.
Here is the line that is causing the issue in my case:
Here is the error output from code:
Here is a starting point which is causing the error: