I'm trying to install pyAudio using pip for a Voice Assistant project I'm building. When I try to run the code, it returns this error saying no module named 'pyaudio'. So I assumed I have to install pyaudio again in order to make it work.
But while installing pyaudio, I'm getting this error. I've tried many methods like installing portaudio, clearing cache of pip, updating, uninstalling, re-installing packages, pip and python.
I'm fairy new to python so please don't mind if this is a rookie error.
macOS 12.3.1, Python 3.9.1, env virtual environment
Collecting pyaudio Using cached PyAudio-0.2.11.tar.gz (37 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: pyaudio Building wheel for pyaudio (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [13 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.9-x86_64-cpython-39 copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39 running build_ext building '_portaudio' extension creating build/temp.macosx-10.9-x86_64-cpython-39 creating build/temp.macosx-10.9-x86_64-cpython-39/src gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Users/setukumar/Downloads/Virtual-Personal-Assistant-using-Python-master/env/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error: command '/usr/bin/gcc' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. 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: subprocess-exited-with-error × Running setup.py install for pyaudio did not run successfully. │ exit code: 1 ╰─> [15 lines of output] running install /Users/setukumar/Downloads/Virtual-Personal-Assistant-using-Python-master/env/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build/lib.macosx-10.9-x86_64-cpython-39 copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39 running build_ext building '_portaudio' extension creating build/temp.macosx-10.9-x86_64-cpython-39 creating build/temp.macosx-10.9-x86_64-cpython-39/src gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Users/setukumar/Downloads/Virtual-Personal-Assistant-using-Python-master/env/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error: command '/usr/bin/gcc' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> pyaudio note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.