riffusion / riffusion

Stable diffusion for real-time music generation

Home Page:http://riffusion.com/about

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install error: No audio backend is available

DaemonAlchemist opened this issue · comments

The installation instructions do not contain information on how to install an audio backend for torch audio, so an error is thrown on startup if not audio backend is installed:

https://stackoverflow.com/questions/62543843/cannot-import-torch-audio-no-audio-backend-is-available

try this
apt install -y libav-tools

commented

I needed to manually install Torch with the command from this website (https://pytorch.org/get-started/locally/) in the anaconda environment; the requirements.txt does not install it properly.

I also installed SoundFile (pip install soundfile) as described in that Stack Overflow link you posted.

Sorry if I wasn't clear. I was able to figure out what dependencies were needed and install them myself. This issue is about adding that info to the installation instructions so other users wouldn't have to do that troubleshooting themselves.

would Dockerfile be fine for you? I am trying to do one

I ran into this same error. I'd love if there's clear instructions to fix it.

I am seeing this warning when I start the flask server:
/opt/conda/envs/riffusion/lib/python3.9/site-packages/torchaudio/_internal/module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available.
warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")

however it seems like inference is successful - I still haven't verified that actual sounds are produced.

is this the same problem? can you please share how to remove this warning?

commented

I am seeing this warning when I start the flask server: /opt/conda/envs/riffusion/lib/python3.9/site-packages/torchaudio/_internal/module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available. warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")

however it seems like inference is successful - I still haven't verified that actual sounds are produced.

is this the same problem? can you please share how to remove this warning?

That most likely means you have soundfile python package installed, but the actual backing library libsndfile is not available.
You need to install it manually.

From: https://pysoundfile.readthedocs.io/en/latest/#installation

On Linux, you need to install libsndfile using your distribution’s package manager, for example sudo apt-get install libsndfile1.

Thanks for the tip @mthrok ! I added libsndfile1 to the CI and it resolved the no audio backend warning. I also added it to the README and linked to this issue.