Fixing torchaudio backend error when loading audio files in Python

I’m trying to process audio files using torchaudio but running into issues. When I execute audio_info = torchaudio.info(AUDIO_FILE_PATH) I get this error: RuntimeError: Couldn't find appropriate backend to handle uri _assets\sample.wav and format None

I checked my available backends with print(torchaudio.list_audio_backends()) and it returns an empty list, which means no audio backends are detected.

I’ve attempted multiple installation methods:

  • conda install pytorch torchvision torchaudio -c pytorch
  • conda install -c conda-forge pysoundfile
  • pip install soundfile
  • pip install PySoundFile

Despite trying all these approaches, the error persists. My conda environment shows both pysoundfile and soundfile as installed packages, but torchaudio still can’t detect any backends. I’m working on Windows 11.

Has anyone encountered this backend detection issue before? What additional steps might resolve this problem?

Had this same problem when I moved a project to a new Windows machine. Torchaudio wasn’t linking properly to the audio libraries in my conda environment. Here’s what fixed it for me: nuke your current environment and rebuild it from scratch, but install things in the right order. Remove torchaudio completely first. Then run conda install -c conda-forge ffmpeg before you reinstall PyTorch. This sets up the backend connections properly. Once everything’s installed, test it by running torchaudio.get_audio_backend() - you should get a valid backend name instead of an error.

that’s odd! maybe try reinstalling pytorch? sometimes the backends act up. what python version r u using? I faced this on 3.11 and had to downgrade. curious if that’s the issue!

i had that issue too! try importing soundfile b4 torchaudio like this: import soundfile, then import torchaudio. sometimes the backend doesn’t register on its own. also, check ur pytorch version - older ones can mess up backend detection.