Home > Enterprise >  OSError: No Default Input Device Available in AWS EC2
OSError: No Default Input Device Available in AWS EC2

Time:10-12

I deployed a Django APP into AWS EC2 and used pyaudio and speech_recognition. When I run the endpoint, it says:

device_index = pa.get_default_input_device() OSError: No Default Input Device Available

Here is my code:

import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
  r.adjust_for_adbient_noise(source)

CodePudding user response:

This is an impossible ask.

You’re running an EC2 instance, which is a virtual machine running on a computer of 100s & 1000s possibly etc. of other virtual machines.

AWS does not give you access to the microphone of the machine, as:

  1. It probably doesn’t have one
  2. If it did, they’d be no point as you’ll just hear data centre background noise if any
  3. It 99.99% definitely won’t have one

If you need microphone input, use your local machine & not a machine in the cloud.

  • Related