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

Viewed 11834
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.')

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 PySoundFile

Sox for Linux pip install sox

Check out the PyTorch Audio Backend docs here

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

Related