Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot import torch audio ' No audio backend is available.'

import torchaudio

When I just try to import torch audio on Pycharm, I have this error

61: UserWarning: No audio backend is available.

warnings.warn('No audio backend is available.')

like image 643
Carlita M. F. Román Avatar asked Sep 07 '25 16:09

Carlita M. F. Román


2 Answers

You need to install the audio file I/O backend. If Linux it's Sox, if Windows it's SoundFile

To check if you have one set run str(torchaudio.get_audio_backend()) and if 'None' is the result then install the backend.

SoundFile for Windows pip install soundfile

Sox for Linux pip install sox

Check out the PyTorch Audio Backend docs here

like image 57
Cassie Breviu Avatar answered Sep 10 '25 07:09

Cassie Breviu


Just to put it out there.

I am using conda on windows 10. I tried to install PySoundFile from conda distribution conda install -c conda-forge pysoundfile but it doesn't work.

Turns out we have to use pip install PySoundFile

like image 40
kdebugging Avatar answered Sep 10 '25 07:09

kdebugging