Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Raviu56 opened this issue Jan 11, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Raviu56
Copy link

Raviu56 commented Jan 11, 2024

🐛 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 Raviu56 added the bug Something isn't working label Jan 11, 2024
@Raviu56
Copy link
Author

Raviu56 commented Jan 11, 2024

It was fixed after running
pip install ffmpeg

Should be added to encodec dependencies

@McBaws
Copy link

McBaws commented Mar 27, 2024

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

@therahulr
Copy link

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

@mdeyneka
Copy link

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

@tikikun
Copy link

tikikun commented Jun 17, 2024

pip install soundfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants