Reputation: 9428
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('"'"'\r\n'"'"', '"'"'\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/
Upvotes: 7
Views: 12819
Reputation: 1
Goes to this site:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
And search (by pressing ctrl+f) for pyaudio
. Then you download your whl file of your python suitable version and open windows poweshell in the downloads folder where you downloaded the file. After that, open poweshell, type pip, install filename and then hit enter. Installed easily.
Upvotes: 0
Reputation: 26
I was please to follow these step after I found out Python installation on my Ubuntu 20.04 machine. Some libraries which were easily install-able on Ubuntu 18.04 are not getting installed on 20.04 for that some dependency issue can occur. After a proper Python installation I could avoid avoid any PyAudio issue.
Tested only on Ubuntu machine:
1- sudo apt-get update
2- sudo apt-get install -y build-essential check install
3- sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
I will be installing it from /usr/src but you can use any location of your choice:
4 - cd /usr/src sudo wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
**Extracting downloaded package:**
5- sudo tar xzf Python-3.6.9.tgz
**Compiling Source:**
6- cd Python-3.6.9 7- sudo ./configure --enable-optimizations
**Building python:**
8- sudo make altinstall
**Verify Installation:**
9- python3.6 --version
Upgrading pip (optional): 10 - Install dependency for pip sudo apt-get install -y python3-distutils python3-testresources
**Downloading get-pip.py and running:**
11- cd ~/ wget https://bootstrap.pypa.io/get-pip.py sudo python3.6 get-pip.py
12- If you like to use Alias?
alias py36=python3.6 alias pip36=pip3.6
** Using update-alternatives**
Check your python path for adding it to update-alternatives config:
13 - which python3.6
My path was /usr/local/bin/python3.6 Adding path to update-alternatives config:
14 - sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.6 0
15 - sudo apt install libasound2-dev portaudio19-dev libportaudio2 ibportaudiocpp0 ffmpeg
16- pip install pyaudio
###Lycka till ###
Upvotes: 0
Reputation: 26
I was pleased to follow these step after I found out Python installation on my Ubuntu 20.04 machine. Some libraries which were easily install-able on Ubuntu 18.04 are not getting installed on 20.04 for that some dependency issue can occur. After a proper Python installation, I could avoid any pyaudio issue.
Tested only on Ubuntu machine:
sudo apt-get update
sudo apt-get install -y build-essential checkinstall
Upvotes: 0
Reputation: 9428
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.
Upvotes: 21