Python Assistant (Jarvis)

I was using this video to code the JARVIS assistant:

I dont think my import speech_recognition function is working.

When I run the code until the takeCommand part, it wishes me but does not listen to my voice. This is the error I’m getting:

PS C:\Users\nihaa\OneDrive\Desktop\JARVIS> & C:/Users/nihaa/AppData/Local/Microsoft/WindowsApps/python3.12.exe c:/Users/nihaa/OneDrive/Desktop/JARVIS/[jarvis.py ](javascript:void(0):wink: Traceback (most recent call last): File “c:\Users\nihaa\OneDrive\Desktop\JARVIS[jarvis.py](javascript:void(0);)”, line 48, in takeCommand() File “c:\Users\nihaa\OneDrive\Desktop\JARVIS[jarvis.py](javascript:void(0);)”, line 29, in takeCommand with sr.Microphone() as source: ^^^^^^^^^^^^^^^ File “C:\Users\nihaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\speech_recognition_init__.py”, line 80, in init self.pyaudio_module = self.get_pyaudio() ^^^^^^^^^^^^^^^^^^ File "C:\Users\nihaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\speech_recognition_init.py", line 111, in get_pyaudio from distutils.version import LooseVersion ModuleNotFoundError: No module named ‘distutils’

Can someone help me with this?

Maybe because distutils is gone?

If you pip install setuptools then you should get enough distutils back to be able to run this.

this worked, thank you so much!
also, for this code to work, do i need to set up voice access and on my PC?
because the error went away with your solution, however, i still dont think it is hearing me because it doesnt not print what i said.
i tried setting up voice access but that makes my computer also listen to the commands i’m trying to give JARVIS

Wild guess here, but I think “voice access” may refer to the OS’s voice assistant only. Try (if you can) give access to just your microphone.

i tried doing that but it didnt work, it seems like if i want my PC listening to anything i’m saying in real time then i need to have the speech access on.
however, even with that, my speech recognition code does not seem to be working.
anyone know what i may be doing wrong?

you can see below that the import speech recognition command is not being recognized:

Hmm…people from time to time on this forum posts that they installed a Python package and the package is not recognized by their IDE-s.

If I remember correctly, if you have got installed many versions of Python (which is not as bad as it seems) then you have to check in your IDE settings with which version of Python it is executing.