How to fix: “Could not import the PyAudio C module ‘_portaudio'”

When running PyAudio the first time, you may encounter the following error:

Could not import the PyAudio C module ‘_portaudio’.
Traceback (most recent call last):

File “generate_sine.py”, line 7, in
import pyaudio

File “pyaudio.py”, line 116, in
import _portaudio as pa

ImportError: DLL load failed: The specified module could not be found.

It seems that this is caused by failure to install the all the dependencies.

To fix this: install portaudio with the following line:

conda install -c anaconda portaudio

Leave a comment