Skip to content
Advertisement

Failed installing pyaudio on Google Colab with “ERROR: Failed building wheel for pyaudio”

Trying to install pyaudio on Google Colab but got an error “ERROR: Failed building wheel for pyaudio”.

!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools
!pip install pyaudio

I got this error:

Collecting pyaudio
  Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... error
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-000dzv_9/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tvs_aja7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-000dzv_9/pyaudio/

Advertisement

Answer

I just need to remove libav-tools from apt install and run this command again.

!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg

Now pyaudio is installed successfully.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement