encodec icon indicating copy to clipboard operation
encodec copied to clipboard

RuntimeError Couldn't find appropriate backend to handle uri {uri} and format {format}.

Open Raviu56 opened this issue 1 year ago • 5 comments

🐛 Bug Report

Whenever I run encodec I get:

$ encodec -b 3.0 -s encodec cut_original.wav 
/tmp/encodec_vnenv/lib64/python3.11/site-packages/torch/nn/utils/weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
  warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
Traceback (most recent call last):
  File "/tmp/encodec_vnenv/bin/encodec", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tmp/encodec_vnenv/lib/python3.11/site-packages/encodec/__main__.py", line 109, in main
    wav, sr = torchaudio.load(args.input)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/encodec_vnenv/lib64/python3.11/site-packages/torchaudio/_backend/utils.py", line 203, in load
    backend = dispatcher(uri, format, backend)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/encodec_vnenv/lib64/python3.11/site-packages/torchaudio/_backend/utils.py", line 115, in dispatcher
    raise RuntimeError(f"Couldn't find appropriate backend to handle uri {uri} and format {format}.")
RuntimeError: Couldn't find appropriate backend to handle uri cut_original.wav and format None.

To Reproduce

(Write your steps here:)

  1. create a python virtualenv
  2. activate it and run pip install -U git+https://[email protected]/facebookresearch/encodec#egg=encodec
  3. run encodec like encodec -b 3.0 -s encodec cut_original.wav I've trying different file formats mp3/m4a and others, no success
  4. also tried the stable version with pip no success

Expected behavior

It should simply work

Actual Behavior

Error above

Your Environment

$ pip freeze
einops==0.7.0
encodec @ git+https://[email protected]/facebookresearch/encodec@0e2d0aed29362c8e8f52494baf3e6f99056b214f
filelock==3.13.1
fsspec==2023.12.2
Jinja2==3.1.3
MarkupSafe==2.1.3
mpmath==1.3.0
networkx==3.2.1
numpy==1.26.3
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.18.1
nvidia-nvjitlink-cu12==12.3.101
nvidia-nvtx-cu12==12.1.105
sympy==1.12
torch==2.1.2
torchaudio==2.1.2
triton==2.1.0
typing_extensions==4.9.0
  • Python 3.11
  • Operating system: openSUSE Tumbleweed
  • Hardware (gpu or cpu, amount of RAM etc.): nvidia [GeForce RTX 3050 with installed working drivers and cuda which I've already been used for other ML projects.

Raviu56 avatar Jan 11 '24 19:01 Raviu56

It was fixed after running pip install ffmpeg

Should be added to encodec dependencies

Raviu56 avatar Jan 11 '24 19:01 Raviu56

installing ffmpeg didn't fix this for me, but doing pip install soundfile did

McBaws avatar Mar 27 '24 16:03 McBaws

I am having issue with MacOS (M2 Max).

File "/Users/rahul/.local/lib/python3.11/site-packages/torchaudio/_backend/utils.py", line 312, in save backend = dispatcher(uri, format, backend) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/rahul/.local/lib/python3.11/site-packages/torchaudio/_backend/utils.py", line 222, in dispatcher raise RuntimeError(f"Couldn't find appropriate backend to handle uri {uri} and format {format}.") RuntimeError: Couldn't find appropriate backend to handle uri separated/htdemucs/02 Saans/vocals.wav and format None.

Tried many commands:

demucs --segment 6 -d cpu --two-stems=vocals songs/02\ Saans.wav demucs --two-stems=vocals songs/02\ Saans.wav

Python 3.9

Conda Environment:

╰─$ pip list Package Version Editable project location


antlr4-python3-runtime 4.9.3 attrs 23.2.0 cffi 1.16.0 cloudpickle 3.0.0 colorama 0.4.6 colorlog 6.8.2 Cython 3.0.10 demucs 4.1.0a2 /Volumes/Work/projects/research/demucs diffq 0.2.4 dora_search 0.1.12 einops 0.7.0 ffmpeg 1.4 ffmpeg-python 0.2.0 filelock 3.13.4 fsspec 2024.3.1 future 1.0.0 gmpy2 2.1.2 hydra-colorlog 1.2.0 hydra-core 1.3.2 Jinja2 3.1.3 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 julius 0.2.7 lameenc 1.7.0 MarkupSafe 2.1.5 mpmath 1.3.0 musdb 0.4.2 museval 0.4.1 networkx 3.2.1 numpy 1.26.4 omegaconf 2.3.0 openunmix 1.2.1 packaging 24.0 pandas 2.2.2 pip 24.0 pyaml 23.12.0 pycparser 2.22 python-dateutil 2.9.0.post0 pytz 2024.1 PyYAML 6.0.1 referencing 0.34.0 retrying 1.3.4 rpds-py 0.18.0 scipy 1.13.0 setuptools 69.5.1 simplejson 3.19.2 six 1.16.0 soundfile 0.12.1 stempeg 0.2.3 submitit 1.5.1 sympy 1.12 torch 2.0.0 torchaudio 2.0.1 tqdm 4.66.2 treetable 0.2.5 typing_extensions 4.11.0 tzdata 2024.1 wheel 0.43.0

therahulr avatar Apr 15 '24 05:04 therahulr

@therahulr please try to install libsox.so and check again One of the possible commands: brew install sox

mdeyneka avatar Apr 30 '24 21:04 mdeyneka

pip install soundfile

tikikun avatar Jun 17 '24 11:06 tikikun