Skip to content

pytorchcodec does not detect ffmpeg because of undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0 #1355

@papoteur-mga

Description

@papoteur-mga

🐛 Describe the bug

Errors in detecting ffmpeg is already reported. I modified code to get the origin error, the version 7 of ffmpeg being installed, which is:

Traceback (most recent call last):
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torch/_ops.py", line 1488, in load_library
    ctypes.CDLL(path)
    ~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.13/ctypes/__init__.py", line 361, in __init__
    self._handle = self._load_library(name, mode, handle, winmode)
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/ctypes/__init__.py", line 401, in _load_library
    return _dlopen(name, mode)OSError: /lib64/libtiff.so.6: undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0`

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/whisper/whisper.py", line 33, in <module>
    result = pipe("/home/yves/20260428_163726_10min.mp3")
  File "/data/whisper/.venv/lib64/python3.13/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 244, in __call__
    return super().__call__(inputs, **kwargs)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/data/whisper/.venv/lib64/python3.13/site-packages/transformers/pipelines/base.py", line 1256, in __call__
    return next(
        iter(
    ...<3 lines>...
        )
    )
  File "/data/whisper/.venv/lib64/python3.13/site-packages/transformers/pipelines/pt_utils.py", line 126, in __next__
    item = next(self.iterator)
  File "/data/whisper/.venv/lib64/python3.13/site-packages/transformers/pipelines/pt_utils.py", line 271, in __next__
    processed = self.infer(next(self.iterator), **self.params)
                           ~~~~^^^^^^^^^^^^^^^
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torch/utils/data/dataloader.py", line 732, in __next__
    data = self._next_data()
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torch/utils/data/dataloader.py", line 788, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torch/utils/data/_utils/fetch.py", line 33, in fetch
    data.append(next(self.dataset_iter))
                ~~~~^^^^^^^^^^^^^^^^^^^
  File "/data/whisper/.venv/lib64/python3.13/site-packages/transformers/pipelines/pt_utils.py", line 188, in __next__
    processed = next(self.subiterator)
  File "/data/whisper/.venv/lib64/python3.13/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 365, in preprocess
    import torchcodec
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torchcodec/__init__.py", line 12, in <module>
    from . import decoders, encoders, samplers  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torchcodec/decoders/__init__.py", line 7, in <module>
    from .._core import AudioStreamMetadata, VideoStreamMetadata
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torchcodec/_core/__init__.py", line 8, in <module>
    from ._metadata import (
    ...<5 lines>...
    )
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torchcodec/_core/_metadata.py", line 16, in <module>
    from torchcodec._core.ops import (
    ...<3 lines>...
    )
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torchcodec/_core/ops.py", line 104, in <module>
    ffmpeg_major_version, core_library_path = load_torchcodec_shared_libraries()
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torchcodec/_core/ops.py", line 56, in load_torchcodec_shared_libraries
    torch.ops.load_library(core_library_path)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/data/whisper/.venv/lib64/python3.13/site-packages/torch/_ops.py", line 1491, in load_library
    raise OSError(f"Could not load this library: {path}") from e
OSError: Could not load this library: /data/whisper/.venv/lib/python3.13/site-packages/torchcodec/libtorchcodec_core7.so

I identified that /lib64/libtiff.so.6 is the lib from my system, which loads well outside the virtualenv. In fact, I can reproduce the problem when I load libjpeg from the virtualenv before loading libtiff library:

 python
Python 3.13.12 (main, Feb  6 2026, 00:42:45) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.CDLL("./.venv/lib/python3.13/site-packages/torchvision.libs/libjpeg.d246b9ea.so.8")
<CDLL './.venv/lib/python3.13/site-packages/torchvision.libs/libjpeg.d246b9ea.so.8', handle 562681ea2bd0 at 0x7f13f71c27b0>
>>> path = "/lib64/libtiff.so.6"
>>> ctypes.CDLL(path)
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    ctypes.CDLL(path)
    ~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.13/ctypes/__init__.py", line 361, in __init__
    self._handle = self._load_library(name, mode, handle, winmode)
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/ctypes/__init__.py", line 401, in _load_library
    return _dlopen(name, mode)
OSError: /lib64/libtiff.so.6: undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0
>>> exit()
$ python
Python 3.13.12 (main, Feb  6 2026, 00:42:45) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> path = "/lib64/libtiff.so.6"
>>> ctypes.CDLL(path)
<CDLL '/lib64/libtiff.so.6', handle 5577ac5ca270 at 0x7f5b99e927b0>

Our libjpeg is the one from https://libjpeg-turbo.org/ thus this is why the function jpeg12_write_raw_data is used. However, the libjpeg from torchvision.libs interferes and causes the crash.

I installed pytorch through:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.4

Versions

python collect_env.py 
Collecting environment information...
/opt/amdgpu/share/libdrm/amdgpu.ids: No such file or directory
/opt/amdgpu/share/libdrm/amdgpu.ids: No such file or directory
PyTorch version: 2.9.1+rocm6.4
Is debug build: False
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: 6.4.43484-123eb5128

OS: Mageia 10 (x86_64)
GCC version: (Mageia 15.2.0-1.mga10) 15.2.0
Clang version: Could not collect
CMake version: version 4.1.3
Libc version: glibc-2.42

Python version: 3.13.12 (main, Feb  6 2026, 00:42:45) [GCC 15.2.0] (64-bit runtime)
Python platform: Linux-6.18.22-desktop-1.mga10-x86_64-with-glibc2.42
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: 
GPU models and configuration: AMD Radeon Graphics (gfx1100)
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Is XPU available: False
HIP runtime version: 6.4.43484
MIOpen runtime version: 3.4.0
Is XNNPACK available: True
Caching allocator config: N/A

CPU:
Architecture :                            x86_64
Mode(s) opératoire(s) des processeurs :   32-bit, 64-bit
Tailles des adresses:                     48 bits physical, 48 bits virtual
Boutisme :                                Little Endian
Processeur(s) :                           12
Liste de processeur(s) en ligne :         0-11
Identifiant constructeur :                AuthenticAMD
Nom de modèle :                           AMD Ryzen 5 7600X 6-Core Processor
Famille de processeur :                   25
Modèle :                                  97
Thread(s) par cœur :                      2
Cœur(s) par socket :                      6
Socket(s) :                               1
Révision :                                2
Accroissement de fréquence :              activé
multiplication des MHz du/des CPU(s) :    65%
Vitesse maximale du processeur en MHz :   5457,1050
Vitesse minimale du processeur en MHz :   427,3640
BogoMIPS :                                9381,88
Drapeaux :                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpuid_fault cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor smca fsrm flush_l1d amd_lbr_pmc_freeze
Virtualisation :                          AMD-V
Cache L1d :                               192 KiB (6 instances)
Cache L1i :                               192 KiB (6 instances)
Cache L2 :                                6 MiB (6 instances)
Cache L3 :                                32 MiB (1 instance)
Nœud(s) NUMA :                            1
Nœud NUMA 0 de processeur(s) :            0-11
Vulnérabilité Gather data sampling :      Not affected
Vulnérabilité Ghostwrite :                Not affected
Vulnérabilité Indirect target selection : Not affected
Vulnérabilité Itlb multihit :             Not affected
Vulnérabilité L1tf :                      Not affected
Vulnérabilité Mds :                       Not affected
Vulnérabilité Meltdown :                  Not affected
Vulnérabilité Mmio stale data :           Not affected
Vulnérabilité Old microcode :             Not affected
Vulnérabilité Reg file data sampling :    Not affected
Vulnérabilité Retbleed :                  Not affected
Vulnérabilité Spec rstack overflow :      Mitigation; Safe RET
Vulnérabilité Spec store bypass :         Mitigation; Speculative Store Bypass disabled via prctl
Vulnérabilité Spectre v1 :                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnérabilité Spectre v2 :                Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; PBRSB-eIBRS Not affected; BHI Not affected
Vulnérabilité Srbds :                     Not affected
Vulnérabilité Tsa :                       Mitigation; Clear CPU buffers
Vulnérabilité Tsx async abort :           Not affected
Vulnérabilité Vmscape :                   Mitigation; IBPB before exit to userspace

Versions of relevant libraries:
[pip3] numpy==2.4.4
[pip3] nvidia-cublas==13.1.0.3
[pip3] nvidia-cuda-cupti==13.0.85
[pip3] nvidia-cuda-nvrtc==13.0.88
[pip3] nvidia-cuda-runtime==13.0.96
[pip3] nvidia-cudnn-cu13==9.19.0.56
[pip3] nvidia-cufft==12.0.0.61
[pip3] nvidia-curand==10.4.0.35
[pip3] nvidia-cusolver==12.0.4.66
[pip3] nvidia-cusparse==12.6.3.3
[pip3] nvidia-cusparselt-cu13==0.8.0
[pip3] nvidia-nccl-cu13==2.28.9
[pip3] nvidia-nvjitlink==13.0.88
[pip3] nvidia-nvtx==13.0.85
[pip3] pytorch-triton-rocm==3.5.1
[pip3] torch==2.9.1+rocm6.4
[pip3] torchaudio==2.9.1+rocm6.4
[pip3] torchcodec==0.9.1
[pip3] torchvision==0.24.1+rocm6.4
[pip3] triton==3.6.0
[conda] Could not collect

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions