MOSS-TTS icon indicating copy to clipboard operation
MOSS-TTS copied to clipboard

Could not load this library: libtorchcodec_core4.dll

Open JiangYanting opened this issue 8 months ago • 3 comments

when I ran this Basic Usage code, I encountered this error:

OSError: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core4.dll
[end of libtorchcodec loading traceback].

this is my package version: torch 2.9.1 torchaudio 2.9.1 torchcodec 0.10.0

thank you for your help.

JiangYanting avatar Mar 19 '26 01:03 JiangYanting

Hi, thanks for reporting this!

The error is caused by a version mismatch between torchcodec and your PyTorch installation. torchcodec has strict compatibility requirements with specific PyTorch versions, and 0.10.0 doesn't match torch 2.9.1.

You can fix this by downgrading it to a compatible version:

pip install torchcodec==0.8.1

Then re-run the script and it should work fine. Feel free to let us know if you still encounter any issues!

WangJinbaekhyun avatar Mar 19 '26 05:03 WangJinbaekhyun

Hi, thanks for reporting this!

The error is caused by a version mismatch between torchcodec and your PyTorch installation. torchcodec has strict compatibility requirements with specific PyTorch versions, and 0.10.0 doesn't match torch 2.9.1.

You can fix this by downgrading it to a compatible version:

pip install torchcodec==0.8.1

Then re-run the script and it should work fine. Feel free to let us know if you still encounter any issues!

thank you, it works. Then I encounter another error:

RuntimeError: Could not load libtorchcodec. Likely causes:
          1. FFmpeg is not properly installed in your environment. We support
             versions 4, 5, 6, and 7 on all platforms, and 8 on Mac and Linux.
        ......
FFmpeg version 8: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core8.dll
FFmpeg version 7: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core7.dll
FFmpeg version 6: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core6.dll
FFmpeg version 5: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core5.dll
FFmpeg version 4: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core4.dll
[end of libtorchcodec loading traceback].

my OS is windows. Do I need to install FFmpeg on my computer?

Image

DHfusion avatar Mar 20 '26 04:03 DHfusion

Hi, thanks for reporting this! The error is caused by a version mismatch between torchcodec and your PyTorch installation. torchcodec has strict compatibility requirements with specific PyTorch versions, and 0.10.0 doesn't match torch 2.9.1. You can fix this by downgrading it to a compatible version: pip install torchcodec==0.8.1 Then re-run the script and it should work fine. Feel free to let us know if you still encounter any issues!

thank you, it works. Then I encounter another error:

RuntimeError: Could not load libtorchcodec. Likely causes:
          1. FFmpeg is not properly installed in your environment. We support
             versions 4, 5, 6, and 7 on all platforms, and 8 on Mac and Linux.
        ......
FFmpeg version 8: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core8.dll
FFmpeg version 7: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core7.dll
FFmpeg version 6: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core6.dll
FFmpeg version 5: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core5.dll
FFmpeg version 4: Could not load this library: D:\miniconda_env_3_mosstts\Lib\site-packages\torchcodec\libtorchcodec_core4.dll
[end of libtorchcodec loading traceback].

my OS is windows. Do I need to install FFmpeg on my computer?

Image

I have solved this error: https://github.com/BtbN/FFmpeg-Builds/releases here is a release that worked for me. Then I did

import os 
os.add_dll_directory("D:/experiments/ffmpeg/bin")

thank you for your help (∩_∩)

DHfusion avatar Mar 20 '26 11:03 DHfusion