nomadkaraoke / python-audio-separator

Easy to use stem (e.g. instrumental/vocals) separation from CLI or as a python package, using a variety of amazing pre-trained models (primarily from UVR)
MIT License
477 stars 82 forks source link

Cannot use mp3 file that UVR was working with. #77

Closed drakon660 closed 1 month ago

drakon660 commented 4 months ago

ERROR:

2024-06-12 20:20:51.828 - INFO - cli - Separator version 0.17.3 beginning with input file: /home/Downloads/example.mp3 2024-06-12 20:20:51.829 - INFO - separator - Separator version 0.17.3 instantiating with output_dir: output, output_format: FLAC 2024-06-12 20:20:51.829 - INFO - separator - Operating System: Linux #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 2024-06-12 20:20:51.830 - INFO - separator - System: Linux Node: ryzen Release: 6.8.0-35-generic Machine: x86_64 Proc: x86_64 2024-06-12 20:20:51.830 - INFO - separator - Python Version: 3.11.7 2024-06-12 20:20:51.830 - INFO - separator - PyTorch Version: 2.3.1+cu121 2024-06-12 20:20:51.837 - INFO - separator - FFmpeg installed: ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers 2024-06-12 20:20:51.837 - INFO - separator - ONNX Runtime CPU package installed with version: 1.17.3 2024-06-12 20:20:51.841 - INFO - separator - CUDA is available in Torch, setting Torch device to CUDA 2024-06-12 20:20:51.841 - WARNING - separator - CUDAExecutionProvider not available in ONNXruntime, so acceleration will NOT be enabled 2024-06-12 20:20:51.841 - INFO - separator - Loading model model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt... 2024-06-12 20:20:54.031 - INFO - mdxc_separator - MDXC Separator initialisation complete 2024-06-12 20:20:54.031 - INFO - separator - Load model duration: 00:00:02 2024-06-12 20:20:54.031 - INFO - separator - Starting separation process for audio_file_path: /home/Downloads/example.mp3 Traceback (most recent call last): File "/home/drakon660/anaconda3/lib/python3.11/site-packages/librosa/core/audio.py", line 176, in load y, sr_native = soundfile_load(path, offset, duration, dtype) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/librosa/core/audio.py", line 209, in __soundfile_load context = sf.SoundFile(path) ^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/soundfile.py", line 740, in init__ self._file = self._open(file, mode_int, closefd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/soundfile.py", line 1264, in _open _error_check(_snd.sf_error(file_ptr), File "/home/drakon660/anaconda3/lib/python3.11/site-packages/soundfile.py", line 1455, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error opening '/home/Downloads/example.mp3': System error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/drakon660/anaconda3/bin/audio-separator", line 8, in sys.exit(main()) ^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/audio_separator/utils/cli.py", line 177, in main output_files = separator.separate(args.audio_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/audio_separator/separator/separator.py", line 699, in separate output_files = self.model_instance.separate(audio_file_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/audio_separator/separator/architectures/mdxc_separator.py", line 129, in separate mix = self.prepare_mix(self.audio_file_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/audio_separator/separator/common_separator.py", line 176, in prepare_mix mix, sr = librosa.load(mix, mono=False, sr=self.sample_rate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/drakon660/anaconda3/lib/python3.11/site-packages/librosa/core/audio.py", line 178, in load except sf.SoundFileRuntimeError as exc: ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'soundfile' has no attribute 'SoundFileRuntimeError'

working with UVR image

beveradb commented 4 months ago

Hey, that's strange as I believe that error is connected to an older, broken version of librosa which bundles the wrong version of soundfile. audio-separator specifically requires a newer version of librosa.

How did you install audio-separator? Using pip, conda or in docker? If using pip, did you use a clean virtualenv or might you have other conflicting dependencies? Could you share the output from pip freeze in your environment so I can see what version of librosa and soundfile are being used?

drakon660 commented 4 months ago

Here you go (yes it is windows but problem is the same):

(spleeter_env) C:\Users\drakon660>pip freeze audioread==3.0.1 certifi @ file:///C:/b/abs_85o_6fm0se/croot/certifi_1671487778835/work/certifi cffi==1.15.1 charset-normalizer==3.3.2 decorator==5.1.1 idna==3.7 importlib-metadata==6.7.0 joblib==1.3.2 lazy_loader==0.4 librosa==0.10.2.post1 llvmlite==0.39.1 msgpack==1.0.5 numba==0.56.4 numpy==1.21.6 packaging==24.0 platformdirs==4.0.0 pooch==1.8.2 pycparser==2.21 requests==2.31.0 scikit-learn==1.0.2 scipy==1.7.3 soundfile==0.12.1 soxr==0.3.7 threadpoolctl==3.1.0 typing_extensions==4.7.1 urllib3==2.0.7 wincertstore==0.2 zipp==3.15.0

beveradb commented 1 month ago

Hey @drakon660 sorry for the super slow reply, I've had a busy couple months.

It's strange, the versions of soundfile and librosa in your output there match mine, but you obviously have a different (old) version of the soundfile code somehow.

This comment seems to suggest there's a conflict with the older pysoundfile package: https://github.com/bastibe/python-soundfile/issues/414#issuecomment-2312637419

So perhaps you might be able to resolve it by reinstalling soundfile:

Please give that a try first and see if it resolves the issue for you!

If you're still getting the same module 'soundfile' has no attribute 'SoundFileRuntimeError' error after doing that, please provide the log output from those pip commands so I can try to understand how you're still getting an old version of soundfile.

I'm closing this issue as I'm confident it isn't a problem with audio-separator, but I'm still willing to help you resolve it in your environment if you tag me in your next reply 😄