11

I am writing a program in Python on RaspberryPi, But I am getting an error

ImportError No module named pyaudio

After that I tried

git clone http://people.csail.mit.edu/hubert/git/pyaudio.git

but again get another

fatal: destination path 'pyaudio' already exists and is not an empty directory.

Can you please guide me that how do I install PyAudio in RaspberryPi

Fahadkalis
  • 2,971
  • 8
  • 23
  • 40

9 Answers9

18

Remove the directory PyAudio which already presen in /home/pi and then try these steps

sudo apt-get install git

sudo git clone http://people.csail.mit.edu/hubert/git/pyaudio.git

sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev

sudo apt-get install python-dev

cd pyaudio

sudo python setup.py install

or also you can try this

sudo apt-get install python-pyaudio

let us know if u need more assistance or any other trouble

Fahadkalis
  • 2,971
  • 8
  • 23
  • 40
11

If

sudo apt-get install python-pyaudio

did’t work try:

sudo apt-get install python3-pyaudio
Duloren
  • 2,395
  • 1
  • 25
  • 36
8

You can simply install PyAudio by executing this command:

pip install pipwin
pipwin install pyaudio
chandan prasad
  • 111
  • 1
  • 10
6

python -m pip install pyaudio

This command works if you already have pip installed.
If not, first install pip and ty

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
sanjay
  • 61
  • 1
  • 2
2

download suitable version of PyAudio File: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

Then Open CMD type : C:\Users\Programs\Python\Python37\Scripts add "pip install"

file location where you download the PyAudio whl file add File name

example:C:\Users\Programs\Python\Python37\Scripts>pip install C:\Users\Desktop\Projects\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl

Suraj Verma
  • 463
  • 6
  • 8
1

I'm on Mac and installing homebrew, then

brew install portaudio 
pip install pyaudio

solved my issue

hakuna22
  • 11
  • 2
0

Install using below command

conda install -c anaconda pyaudio

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
0
pip install pyaudio

this worked for me,hope it helps you too.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30289466) –  Nov 08 '21 at 18:12
  • At least two existing answers already suggest this. Please don't repeat answers. – ChrisGPT was on strike Nov 08 '21 at 18:26
0

This command worked for me:

conda install -c anaconda pyaudio
cafce25
  • 15,907
  • 4
  • 25
  • 31