2

I wrote my code in Streamlit and I’ve been using “sounddevice” for my app. I placed sounddevice in my requirements.txt in my github repo and also imported it in my streamlit code. It works well in my local Streamlit. However, I keep on getting this error every time I deploy my app in Heroku:

OSError: PortAudio library not found
Traceback:
  File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/ScriptRunner.py", line 314, in _run_script
    exec(code, module.__dict__)
  File "/app/helloworld.py", line 11, in <module>
    import sounddevice as sd
  File "/app/.heroku/python/lib/python3.6/site-packages/sounddevice.py", line 71, in <module>
    raise OSError('PortAudio library not found')

Would anyone know how to go about this? Thank you!

Noki
  • 870
  • 10
  • 22
emk
  • 21
  • 1
  • 2

1 Answers1

1

PortAudio is a sound driver that needs to be installed on the operating system level in order for Python libraries to have the ability to hook into it. This error would come up for any code that uses portaudio, so it's not really a Streamlit error.

The Heroku documentation points to installing an apt buildpack as a bootstrap for being able to build packages as you would on Ubuntu Linux.

Once you can install packages, I expect that this StackOverflow thread about installing portaudio on Ubuntu would get you the rest of the way there.

nthmost
  • 151
  • 5