pyaudio installed, "No module named 'pyaudio'"

Viewed 621
$ python -m pip install pyaudio
Requirement already satisfied: pyaudio in c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (0.2.11)

$ py sound.py
Traceback (most recent call last):
  File "sound.py", line 1, in <module>
    import pyaudio
ModuleNotFoundError: No module named 'pyaudio'

pyaudio was installed via a .whl file. This is on Windows 10, python version 3.8.5

5 Answers

this mostly happens if you have installed two python versions.

here you are using "python". $ python -m pip install pyaudio

and to execute you are using "py". $ py sound.py

run it using python sound.py

Visit this link https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio and download the corresponding wheel to your python version, then type "pip install {the wheel you installed}", if this doesn't work then make sure you moved the wheel from Downloads to your terminal path

I could resolved PyAudio error after a long search

Hope this can help someone doing speech text recognition and trying to install PyAudio :

First you find the python version using : python --version (check both Pycharm and JupyterLab as I had 3.7.6 and 3.10.4 different version and move to correct directory - I pasted the same version whl file in same directory "may be there is another way of doing it - suggestions welcome" )

Once this file is placed in the same directory - "PyAudio-0.2.11-cp37-cp37m-win_amd64.whl" you can use pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl directly

Other findings :

In case the version and file not matching you will get this error

ERROR: PyAudio-0.2.11-cp310-cp310-win32.whl is not a supported wheel on this platform.

simple pip install pyaudio will not work (As read on internet its not working beyond 3.6)

Go to 'file' tab> then 'settings' option> then in the search bar look for 'Python Interpreter', Open that. There u will have an option of adding a package, one somewhat like this '+' sign. Click over it and then many packages will show up. There either type or search for 'PyAudio' and then click the 'Install Package' button. You are done then. Good to go!!

To solve it:

open "Command Prompt" and type cls. click on this Link (https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio) install a package based on your version of python and choose either 32 or 64 bit. after the download type cd download in "Command Prompt" press "Enter" then type pip install py finally click on "tab", then "Enter". Your pyaudio is installed!

Related