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

Upvotes: 26

Views: 51189

Answers (5)

Anna Andreeva Rogotulka
Anna Andreeva Rogotulka

Reputation: 1594

for macOS only helps to install pip install soundfile, sox and ffmpeg already has been installed in system but torchaudio error still was

the list of available backends is empty, please install backend manually.

Upvotes: 2

qmzp
qmzp

Reputation: 79

sudo apt install libsox-dev

This worked for me on ubuntu

Upvotes: 1

pcomitz
pcomitz

Reputation: 101

conda install -c conda-forge pysoundfile worked for me on Windows 10 Anaconda also.

Thanks!

Upvotes: 2

Cassie Breviu
Cassie Breviu

Reputation: 571

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

Upvotes: 57

kdebugging
kdebugging

Reputation: 561

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

Upvotes: 7

Related Questions