element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum Looking for support resources for GNURadio
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 9 replies
  • Subscribers 302 subscribers
  • Views 3323 views
  • Users 0 members are here
  • gnuradio
  • troubleshooting gnuradio
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

Looking for support resources for GNURadio

colporteur
colporteur over 4 years ago

Can you share resources you have used or are aware of for troubleshooting issues with GNURadio software installation on Ubuntu?

 

I am receiving error messages when I try to use a Audio Source or Audio Sink block? My goal was to test the GNURadio installation using a audio source and audio sink block and/or Signal Source and Audio sink blocks and have it play a tone from the computer speaker. I have followed the suggested fixes in the following link because they make some reference to Audio. It didn't resolve my issue.

https://wiki.gnuradio.org/index.php/ALSAPulseAudio

https://wiki.gnuradio.org/index.php/Audio_Source

https://wiki.gnuradio.org/index.php/Audio_Sink

 

The environment:

tried

GNURadio version 3.8.1.0 (Python 3.8.5): Ubuntu package install

tried

GNURadio version 3.9 Ubuntu package install

Ubuntu 20.04.2 LTS

uname -r 5.8.0-43-generic

 

I have been unsuccessful in getting a response from the mailing GNURadio list https://lists.gnu.org/mailman/listinfo/discuss-gnuradio so I can post a question. IT appears to be active but I get no response from my subscription attempts. I had hoped someone has experienced a similar problem and can offer advice.

 

I'm looking for your go-to resource for troubleshooting GNURadio issues. Can you help?

 

Error Messages:

Audio Source error

Generating: '/home/user/Documents/GNURadio/audio.py'

 

Executing: /usr/bin/python3 -u /home/user/Documents/GNURadio/audio.py

 

Warning: failed to XInitThreads()

Traceback (most recent call last):

File "/home/user/Documents/GNURadio/audio.py", line 128, in <module>

main()

File "/home/user/Documents/GNURadio/audio.py", line 106, in main

tb = top_block_cls()

File "/home/user/Documents/GNURadio/audio.py", line 76, in __init__

self.audio_source_0 = audio.source(samp_rate, 'pulse_monitor', True)

AttributeError: type object 'audio' has no attribute 'source'

>>> Done (return code 1)

 

Audio Sink error

Generating: '/home/user/Documents/GNURadio/audio.py'

 

Executing: /usr/bin/python3 -u /home/user/Documents/GNURadio/audio.py

 

Warning: failed to XInitThreads()

Traceback (most recent call last):

File "/home/user/Documents/GNURadio/audio.py", line 130, in <module>

main()

File "/home/user/Documents/GNURadio/audio.py", line 108, in main

tb = top_block_cls()

File "/home/user/Documents/GNURadio/audio.py", line 77, in __init__

self.audio_sink_0 = audio.sink(samp_rate, 'hw:0,0', True)

AttributeError: type object 'audio' has no attribute 'sink'

 

>>> Done (return code 1)

  • Sign in to reply
  • Cancel

Top Replies

  • colporteur
    colporteur over 4 years ago +3
    I found a solution but have gained little knowledge of the root cause of the issue. With a complete fresh install of Ubuntu 20.02.2 LTS and using the resident software manager to install GNURadio 3.8.1…
  • cstanton
    cstanton over 4 years ago +1
    At a glance this looks like an outdated library, or a missing library ('audio' , since from "gnuradio import audio"). The type 'audio' not having an attribute 'sink' would mean that the code either couldn…
  • colporteur
    colporteur over 4 years ago

    I found a solution but have gained little knowledge of the root cause of the issue.

     

    With a complete fresh install of Ubuntu 20.02.2 LTS and using the resident software manager to install GNURadio 3.8.1.0  works. The source and sink error messages don't appear. The old Ubuntu 20.04 install was installed back in Aug.2020. A lot of changes were done over its life.

     

    I tried changing the repository and successfully installed GNURadio 3.9.0.0 version. This was done outside the resident software tool. GNRadio but it did not work. It gave different error messages than what I was experiencing.

     

    I'm left with a working application but no reason what cause it not to work. The new install was a little bit of work but it provides a operating system foundation to build on. I moved all the other application I use over to the new build and will start fresh from there.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • ch2
    ch2 over 4 years ago in reply to colporteur

    Hi Sean;

     

    Unfortunately, I'm in the same position you were:

    • Fedora 32 system
    • Installed Gnuradio
    • Tried to hook a signal source to an audio sink and run it
    • Got the error "AttributeError: type object 'audio' has no attribute 'sink'"

     

    Here are the commands I used to install it:

    sudo dnf copr enable gnuradio/gnuradio-master
    sudo dnf install gnuradio
    gnuradio-companion

     

    Here's how I caused the error:

    • I dragged a Signal Source and an Audio Sink onto the field, and hooked them together
    • It gave a flowgraph error (red arrow) because the signal source was set to 'Complex', while the audio sink was set to 'Integer'.
    • When I set the signal source to integer, the error went away (black arrow), and the Run>Generate and Run>Execute menu options ungreyed themselves and I could run it.

    It gave the following error:

    Executing: /usr/bin/python3 -u /home/user/work/gr/audio.py 
    
    Warning: failed to XInitThreads() 
    QSocketNotifier: Can only be used with threads started with QThread 
    Traceback (most recent call last): 
      File "/home/user/work/gr/audio.py", line 135, in <module> 
        main() 
      File "/home/user/work/gr/audio.py", line 111, in main 
        tb = top_block_cls() 
      File "/home/user/work/gr/audio.py", line 77, in __init__ 
        self.audio_sink_0 = audio.sink(samp_rate, '', True) 
    AttributeError: type object 'audio' has no attribute 'sink' 
    
    >>> Done (return code 1)

     

    Here is the python program it generated:

    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    
    #
    # SPDX-License-Identifier: GPL-3.0
    #
    # GNU Radio Python Flow Graph
    # Title: Not titled yet
    # GNU Radio version: 3.8.2.0
    
    from distutils.version import StrictVersion
    
    if __name__ == '__main__':
        import ctypes
        import sys
        if sys.platform.startswith('linux'):
            try:
                x11 = ctypes.cdll.LoadLibrary('libX11.so')
                x11.XInitThreads()
            except:
                print("Warning: failed to XInitThreads()")
    
    from gnuradio import analog
    from gnuradio import audio
    from gnuradio import gr
    from gnuradio.filter import firdes
    import sys
    import signal
    from PyQt5 import Qt
    from argparse import ArgumentParser
    from gnuradio.eng_arg import eng_float, intx
    from gnuradio import eng_notation
    
    from gnuradio import qtgui
    
    class audio(gr.top_block, Qt.QWidget):
    
        def __init__(self):
            gr.top_block.__init__(self, "Not titled yet")
            Qt.QWidget.__init__(self)
            self.setWindowTitle("Not titled yet")
            qtgui.util.check_set_qss()
            try:
                self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
            except:
                pass
            self.top_scroll_layout = Qt.QVBoxLayout()
            self.setLayout(self.top_scroll_layout)
            self.top_scroll = Qt.QScrollArea()
            self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
            self.top_scroll_layout.addWidget(self.top_scroll)
            self.top_scroll.setWidgetResizable(True)
            self.top_widget = Qt.QWidget()
            self.top_scroll.setWidget(self.top_widget)
            self.top_layout = Qt.QVBoxLayout(self.top_widget)
            self.top_grid_layout = Qt.QGridLayout()
            self.top_layout.addLayout(self.top_grid_layout)
    
            self.settings = Qt.QSettings("GNU Radio", "audio")
    
            try:
                if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                    self.restoreGeometry(self.settings.value("geometry").toByteArray())
                else:
                    self.restoreGeometry(self.settings.value("geometry"))
            except:
                pass
    
            ##################################################
            # Variables
            ##################################################
            self.samp_rate = samp_rate = 32000
    
            ##################################################
            # Blocks
            ##################################################
            self.audio_sink_0 = audio.sink(samp_rate, '', True)
            self.analog_sig_source_x_0 = analog.sig_source_i(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0, 0)
    
    
    
            ##################################################
            # Connections
            ##################################################
            self.connect((self.analog_sig_source_x_0, 0), (self.audio_sink_0, 0))
    
    
        def closeEvent(self, event):
            self.settings = Qt.QSettings("GNU Radio", "audio")
            self.settings.setValue("geometry", self.saveGeometry())
            event.accept()
    
        def get_samp_rate(self):
            return self.samp_rate
    
        def set_samp_rate(self, samp_rate):
            self.samp_rate = samp_rate
            self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
    
    
    
    
    
    def main(top_block_cls=audio, options=None):
    
        if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            style = gr.prefs().get_string('qtgui', 'style', 'raster')
            Qt.QApplication.setGraphicsSystem(style)
        qapp = Qt.QApplication(sys.argv)
    
        tb = top_block_cls()
    
        tb.start()
    
        tb.show()
    
        def sig_handler(sig=None, frame=None):
            Qt.QApplication.quit()
    
        signal.signal(signal.SIGINT, sig_handler)
        signal.signal(signal.SIGTERM, sig_handler)
    
        timer = Qt.QTimer()
        timer.start(500)
        timer.timeout.connect(lambda: None)
    
        def quitting():
            tb.stop()
            tb.wait()
    
        qapp.aboutToQuit.connect(quitting)
        qapp.exec_()
    
    if __name__ == '__main__':
        main()

     

    Note: I also submitted this issue to the GnuRadio github project: https://github.com/gnuradio/gnuradio/issues/4475

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 4 years ago in reply to ch2

    Absolutely awesome! Well not that you have the same issue but, rather than you have the same issue I have. I am not alone, yippee.

     

    Your output is identical to what I received. It appears (my thoughts) the Ubuntu support team does some work on the packages to integrate them into Ubuntu. The SNAP package or the apt install from the repository (different version) all have worked. It is just loading the current version that has the issue.

     

    I do hope you get a response from the team to your issue. I was reluctant to make the report being that I am not familiar with GNURadio installs. I didn't want to give the support team an issue that was related to me not knowing I needed to do something. Good luck.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • phoenixcomm
    phoenixcomm over 4 years ago

    colporteur   try it with a fresh install with the latest debian version (stable)..

    ~~Cris

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 4 years ago in reply to phoenixcomm

    Thanks for the suggestion. I'm partial to the debian variant Ubuntu.

     

    I did try your suggestion of an install with a pristine version of Ubuntu 20.04 in place. No luck, same issues. The package installs had no issues.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • phoenixcomm
    phoenixcomm over 4 years ago in reply to colporteur

    colporteur your copy might be "pristine" but its out of date current is 20.9 Im running 10,7

    ~Cris

    oh I had a problem I count mount my ISO #! I had to do a dd to a flash drive.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 4 years ago in reply to phoenixcomm

    Well I was sporting 18 LTS for the longest time. 20.04 LTS has just been in the last three months. I carved a path on at the bleeding edge in my early days. Now I just seek reliability and stability:)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • phoenixcomm
    phoenixcomm over 4 years ago in reply to colporteur

    colporteur  20.9 is a ROCK!! I have my webserver on it  running RAID 5      www.phoenixcomm.net   ||  www.NexGen-Simuations.com  and others

     

    old box short on memory. works, and works, and works.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • cstanton
    cstanton over 4 years ago

    At a glance this looks like an outdated library, or a missing library ('audio' , since from "gnuradio import audio"). The type 'audio' not having an attribute 'sink' would mean that the code either couldn't interrogate and create an 'instance' of the audio object to refer to, or it isn't defined in the library for 'audio' that 'sink' even exists in it.

     

    Updating from an older version of the libraries to a newer one, and thus creating the dependencies would explain why GNURadio, when using or compiling the same version, would then work.

     

    Either it was interrogating a more localised python library install for GNURadio or the system wide python library install and somewhere along the line realised the dependencies it needed and installed the right ones.

     

    Other typical explanations for these are often down to permissions and having the correct access to folders.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube