Cannot load .mp3 with torchaudio due to no appropriate backend found

Hi,

I’m trying to load the metadata of an mp3 file in a list of mp3 files with torchaudio using the following code:

#Load the metadata of the audio files
meta_list =
for audio_file in os.listdir(audiodir):
if audio_file != ‘.DS_Store’:
meta_list.append(torchaudio.info(audiodir + ‘/’ + audio_file, format=‘mp3’))

However, when I try to do this, I get the following error:

Exception has occurred: RuntimeError
Couldn’t find appropriate backend to handle uri /mnt/data/duck.mp3 and format mp3.
File “/workspaces/audio-generation-vst/train_generator.py”, line 18, in
meta_list.append(torchaudio.info(audiodir + ‘/’ + audio_file, format=‘mp3’))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Couldn’t find appropriate backend to handle uri /mnt/data/duck.mp3 and format mp3.

I am running torchaudio in a Docker dev container with Python 3.11 on a Macbook with M1. I have tried installing the following packages in the Dockerfile:

RUN pip install soundfile
RUN pip install sox
RUN pip install ffmpeg

However, it’s not wokring. Is torchaudio supported on M1?

Best

1 Like

I have the same problem but on a M2. Did you solve it?