soundmeter icon indicating copy to clipboard operation
soundmeter copied to clipboard

IOError: [Errno -9996] Invalid input device (no default output device)

Open erikvold opened this issue 8 years ago • 8 comments

I'm getting the following error with osx 10.11 python 2.7.10

$ soundmeter --collect --seconds 10 -v
Traceback (most recent call last):
  File "/usr/local/bin/soundmeter", line 9, in <module>
    load_entry_point('soundmeter==0.1.3', 'console_scripts', 'soundmeter')()
  File "/Library/Python/2.7/site-packages/soundmeter/meter.py", line 310, in main
    m = Meter(**kwargs)
  File "/Library/Python/2.7/site-packages/soundmeter/meter.py", line 66, in __init__
    frames_per_buffer=FRAMES_PER_BUFFER)
  File "/Library/Python/2.7/site-packages/pyaudio.py", line 750, in open
    stream = Stream(self, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pyaudio.py", line 441, in __init__
    self._stream = pa.open(**arguments)
IOError: [Errno -9996] Invalid input device (no default output device)

erikvold avatar Jun 04 '16 03:06 erikvold

This sounds more like a pyaudio/portaudio error related to your audio hardware/driver. Since soundmeter is very high-level, which uses these library, it's difficult to tell what the problem is, especially when it's working on my side.

My suggestions are:

  • Try to plug in a microphone device to your computer and see if the error still exists
  • Check your system settings on sound and verify if input/output device is working correctly

I searched symptoms for possible solutions:

  • http://stackoverflow.com/questions/37063540/i-cant-run-a-simple-code-using-pyaudio-errno-9996-invalid-output-device-n
  • http://stackoverflow.com/questions/4672155/pyaudio-ioerror-no-default-input-device-available?rq=1
  • http://stackoverflow.com/questions/33382305/pyaudio-ioerror-errno-invalid-input-device-no-default-output-device-9996

You may want to take a look at these, and possibly use the following method to see if you have a default input device:

>>> import pyaudio
>>> pa = pyaudio.PyAudio()
>>> pa.get_default_input_device_info()

shichao-an avatar Jun 04 '16 07:06 shichao-an

I run the function 'get_device_count' but got a 0.Is it the problem of my Operating System?

liguo-jlu avatar Apr 13 '18 04:04 liguo-jlu

I got the same issue on Linux, and resolved it by first installing the ALSA dev library, re-building PortAudio, and then re-installing PyAudio. When you build PortAudio, the output from ./configure will tell you which backends it has available,

  Target ...................... x86_64-unknown-linux-gnu
  C++ bindings ................ no
  Debug output ................ no

  ALSA ........................ yes
  ASIHPI ...................... no

  OSS ......................... yes
  JACK ........................ no

I don't know about OS X, but maybe if you post your config here someone else can help?

gatoatigrado avatar Aug 14 '18 03:08 gatoatigrado

I am a linux user and I am gettnig same issue How I can resolve it

sanjubaba123 avatar May 22 '19 19:05 sanjubaba123

I have been struggling with the same issue for over a month now. Mine is OSError: No Default Input Device Available, and I think it's peculiar to my system as the same code runs on other systems.

import pyaudio pa = pyaudio.PyAudio() pa.get_default_input_device_info()

Trying to check my default input and output devices with the above lines of codes throws the same error.

marvelous-ikechi avatar May 23 '19 23:05 marvelous-ikechi

I got the same issue on Linux, and resolved it by first installing the ALSA dev library, re-building PortAudio, and then re-installing PyAudio. When you build PortAudio, the output from ./configure will tell you which backends it has available,

  Target ...................... x86_64-unknown-linux-gnu
  C++ bindings ................ no
  Debug output ................ no

  ALSA ........................ yes
  ASIHPI ...................... no

  OSS ......................... yes
  JACK ........................ no

I don't know about OS X, but maybe if you post your config here someone else can help?

Hello, my alsa display is installed successfully. But it still reported 9996 error. Could you tell me how to solve the problem。my system is ubuntu16.04

Arch-gx avatar Jan 06 '21 09:01 Arch-gx

On redhat, before compile install portaudio, first run yum install alsa*

smarthand123 avatar Feb 01 '21 07:02 smarthand123

我也是遇到了这个问题 使用的是Pyaudio的Python程序。OSError: [Errno -9996] Invalid input device (no default output device)

xdtxAM avatar Apr 04 '21 07:04 xdtxAM