I tried a lot to solve but finding this issue

Try removing python3-all-dev from packages.txt and reboot the app. Cannot import pyaudio while deploying my app - Community Cloud - Streamlit

If you want to record audio from the microphone, check stefanrmmr/streamlit-audio-recorder: Record Audio from the User’s Microphone in Apps that are Deployed to the Web. (via Browser Media-API, REACT-based, Streamlit Custom Component) (github.com)