Andrew Zacharakis
Andrew Zacharakis

Reputation: 350

Can not import sounddevice in Google Colab

I am trying to import the sounddevice library in Google Colab using the following code:

pip install sounddevice
import sounddevice as sd

but i get the following error.

---------------------------------------------------------------------------

    OSError                                   Traceback (most recent call last)
    
    <ipython-input-8-fba28aeb5c71> in <module>()
          7 import numpy as np
          8 import requests
    ----> 9 import sounddevice as sd
         10 import tensorflow as tf
         11 import keras
    
    /usr/local/lib/python3.6/dist-packages/sounddevice.py in <module>()
         69             break
         70     else:
    ---> 71         raise OSError('PortAudio library not found')
         72     _lib = _ffi.dlopen(_libname)
         73 except OSError:
    
    OSError: PortAudio library not found

Is there a way to use the library in Colab ?

Upvotes: 3

Views: 7565

Answers (1)

ashraful16
ashraful16

Reputation: 2782

I fixed this by installing the portaudio library.

!sudo apt-get install libportaudio2
!pip install sounddevice

Then import sounddevice.

enter image description here

Upvotes: 9

Related Questions