PyAudio cannot find any output devices

2024/11/17 0:05:19

When I run:

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

I get:

IOError: No Default Output Device Available

When I say:

pa.get_device_count()

It returns 0L.

And of course if I list devices

for i in range(0, device_count):print("Name: " + pa.get_device_info_by_index(i)["name"])print("Index: " + pa.get_device_info_by_index(i)["index"])print("\n")

It will not print anything.

I'm running Ubuntu 16.04 and have set my default sink by going:

pacmd list-sinks
pacmd set-default-sink 0

I have the latest versions of PulseAudio, ALSA, and PortAudio. Any suggestions?

Update: I also can't view any sound devices on Audacity, despite the fact that they appear under System Settings>Sound. In Audacity I get the error:

Error while opening sound device. Please check the recording devicesettings and the project sample rate.

I think that this is almost certainly a PortAudio issue since the settings page looks like: enter image description here

Answer

Its likely a broken file that needs replacement.

  1. Search for "/usr/./libstdc++.so.6" where pip installed it.

  2. Search for "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" and copy to location at (1). This should fix it.

  3. If you have Anaconda version 3 - 4.3.0 or 4.4.0 or earlier installed then check at "anaconda3/lib/libstdc++.so.6" and replance with (2).

Alternatively A) rename the file and place the file from (2) where you renamed the old libstdc++.so.6 file or B) upgrade to Anaconda to 5.0.1 version and run conda update --all. And if you do "B" don't forget to remove the eggs or whls manually first to be sure there is no chance installing old software from there again.

This should fix it for you.

Enjoy ;-)

https://en.xdnf.cn/q/71616.html

Related Q&A

How do I write a Hybrid Property that depends on a column in children relationship?

Lets say I have two tables (using SQLAlchemy) for parents and children:class Child(Base):__tablename__ = Childid = Column(Integer, primary_key=True) is_boy = Column(Boolean, default=False)parent_id = C…

Python insert a line break in a string after character X

What is the python syntax to insert a line break after every occurrence of character "X" ? This below gave me a list object which has no split attribute error for myItem in myList.split…

How to use properly Tensorflow Dataset with batch?

I am new to Tensorflow and deep learning, and I am struggling with the Dataset class. I tried a lot of things and I can’t find a good solution. What I am trying I have a large amount of images (500k+)…

How to handle a huge stream of JSON dictionaries?

I have a file that contains a stream of JSON dictionaries like this:{"menu": "a"}{"c": []}{"d": [3, 2]}{"e": "}"}It also includes nested dict…

datatype for handling big numbers in pyspark

I am using spark with python.After uploading a csv file,I needed to parse a column in a csv file which has numbers that are 22 digits long. For parsing that column I used LongType() . I used map() func…

Multi processing code repeatedly runs

So I wish to create a process using the python multiprocessing module, I want it be part of a larger script. (I also want a lot of other things from it but right now I will settle for this)I copied the…

Why use os.setsid() in Python?

I know os.setsid() is to change the process(forked) group id to itself, but why we need it?I can see some answer from Google is: To keep the child process running while the parent process exit.But acc…

How to apply different aggregation functions to same column by using pandas Groupby

It is clear when doingdata.groupby([A,B]).mean()We get something multiindex by level A and B and one column with the mean of each grouphow could I have the count(), std() simultaneously ?so result loo…

Can not connect to an abstract unix socket in python

I have a server written in c++ which creates and binds to an abstract unix socket with a namespace address of "\0hidden". I also have a client which is written in c++ also and this client can…

Pandas display extra unnamed columns for an excel file

Im working on a project using pandas library, in which I need to read an Excel file which has following columns: invoiceid, locationid, timestamp, customerid, discount, tax,total, subtotal, productid, …