ModuleNotFoundError: No module named 'pyaudio' on Mac (with Anaconda installed)

Joined
Nov 25, 2020
Messages
5
Reaction score
0
I'm trying to make a voice assistant with python following this tutorial. I installed Anaconda (individual version) on my Mac like the guy suggested. I said 'conda install PyAudio' in the Pycharm terminal and it successfully got installed (I presume):
(venv) (base) Adityas-MacBook-Air:VoiceRec adityabakshi$ conda install pyaudio Collecting package metadata (current_repodata.json): done Solving environment: done

Package Plan​

environment location: /Users/adityabakshi/opt/anaconda3

added / updated specs: - pyaudio

The following packages will be downloaded:

package | build
---------------------------|-----------------
portaudio-19.6.0 | h647c56a_4 75 KB
pyaudio-0.2.11 | py38h1de35cc_2 203 KB
------------------------------------------------------------
Total: 277 KB

The following NEW packages will be INSTALLED:

portaudio pkgs/main/osx-64::portaudio-19.6.0-h647c56a_4
pyaudio pkgs/main/osx-64::pyaudio-0.2.11-py38h1de35cc_2

Proceed ([y]/n)? y

Downloading and Extracting Packages portaudio-19.6.0 | 75 KB | ################################################################################## | 100% pyaudio-0.2.11 | 203 KB | ################################################################################## | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done
But when I ran this code I have so far (below) right after that:
Python:
import pyttsx3 as p
import speech_recognition as sr

engine = p.init()

engine.say("Hello, I'm your voice assistant")
engine.runAndWait()

r = sr.Recognizer()

with sr.Microphone() as source:
    r.energy_threshold = 10000
    r.adjust_for_ambient_noise(source, 1.2)
    print("listening..")
    audio = r.listen(source)
    text = r.recognize_google(audio)
    print(text)

This error showed up:
/Users/adityabakshi/PycharmProjects/VoiceRec/venv/bin/python /Users/adityabakshi/PycharmProjects/VoiceRec/voiceapp.py Traceback (most recent call last): File "/Users/adityabakshi/PycharmProjects/VoiceRec/venv/lib/python3.8/site-packages/speech_recognition/init.py", line 108, in get_pyaudio import pyaudio ModuleNotFoundError: No module named 'pyaudio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/adityabakshi/PycharmProjects/VoiceRec/voiceapp.py", line 11, in with sr.Microphone() as source: File "/Users/adityabakshi/PycharmProjects/VoiceRec/venv/lib/python3.8/site-packages/speech_recognition/init.py", line 79, in init self.pyaudio_module = self.get_pyaudio() File "/Users/adityabakshi/PycharmProjects/VoiceRec/venv/lib/python3.8/site-packages/speech_recognition/init.py", line 110, in get_pyaudio raise AttributeError("Could not find PyAudio; check installation") AttributeError: Could not find PyAudio; check installation

Process finished with exit code 1
I don't understand...I already installed anaconda and the pyaudio but how is this error showing? (I'm a beginner at Python). Can someone pls help me in fixing this? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top