I want to work with audiofiles in pytorch.
If I try running this line: metadata = torchaudio.info(SAMPLE_WAV_PATH) i get the error message RuntimeError: Couldn't find appropriate backend to handle uri _assets\steam.wav and format None
the internet told me to try str(torchaudio.list_audio_backends()) to see if I have soundfile installed. It appears I don't, because it returns an empty list.
So I tried installing soundfile. Here is a list of commands i tried:
conda install pytorch torchvision torchaudio -c pytorchconda install -c conda-forge pysoundfilepip install soundfilepip install PySoundFile
none of it made a difference. According to the anaconda navigator I have both pysoundfile and soundfile installed, but I still get the same error message. I searched for similar problems and found questions like this cannot import torch audio ' No audio backend is available.' But the only answeres there say I should install soundfile
If somebody got an idea whats wrong I would appreciate some help, thanks in advance.
EDIT I am using windows 11
On my Windows 11 machine with:
No previous installs of
torch,torchvision,torchaudioorPySoundFileI opened command prompt (not as administrator) and ran:
Which installed:
Note: several other dependency packages were installed along with the packages above.
I then ran
python3 ./test.py:Which output an empty list:
So I then ran:
Which installed:
I then re-ran
python3 ./test.pywhich output:I suggest uninstalling all related packages:
You'll probably also want to uninstall
soundfile, since it's in the list of commands you tried.I would then inspect the output of
pip3 listand ensure the packages are no longer there. Then follow the steps I took above, in order, and see if you can get['soundfile']as output.Note: I do not use anaconda, so if the steps above do not resolve your issue then I'd say there's a good chance that it's causing the problem.