psychopy.org | Reference | Downloads | Github

PTB-ERROR: PortAudio can't detect any supported sound device on this system

Hello. I’m trying to get PsychoPy working in a virtual Linux (Ubuntu 20.04) environment that doesn’t have a “real” audio input, just a virtual pulseaudio FIFO source. It works as an audio input in Audacity and Firefox, but trying to run psychopy produces the below error output which, it seems to me, has to do with the application not recognizing the input being available.

Is there a way to work around the requirement for a michophone (using the mic is not necessary in this particular case, so just disabling the check would help)? Or is there some other way to fix this issue?

pygame 2.0.2 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
PTB-INFO: Using modified PortAudio V19.7.0-devel, revision unknown
Error in function GetDevices: 	Usage error
PTB-ERROR: PortAudio can't detect any supported sound device on this system.
PsychPortAudio:GetDevices: Usage:

devices = PsychPortAudio('GetDevices' [, devicetype] [, deviceIndex]);
Traceback (most recent call last):
  File "/usr/local/bin/psychopy", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/psychopyApp.py", line 100, in main
    start_app()
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/psychopyApp.py", line 22, in start_app
    from psychopy.app._psychopyApp import PsychoPyApp
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/_psychopyApp.py", line 26, in <module>
    from . import themes
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/themes/__init__.py", line 1, in <module>
    from ._themes import ThemeMixin, IconCache
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/themes/_themes.py", line 34, in <module>
    allCompons = components.getAllComponents()  # ensures that the icons get checked
  File "/usr/local/lib/python3.8/dist-packages/psychopy/experiment/components/__init__.py", line 63, in getAllComponents
    components = getComponents(fetchIcons=fetchIcons)  # get the built-ins
  File "/usr/local/lib/python3.8/dist-packages/psychopy/experiment/components/__init__.py", line 158, in getComponents
    module = import_module(explicit_rel_path, package=pkg)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.8/dist-packages/psychopy/experiment/components/microphone/__init__.py", line 29, in <module>
    devices = {d.deviceName: d for d in Microphone.getDevices()}
  File "/usr/local/lib/python3.8/dist-packages/psychopy/sound/microphone.py", line 549, in getDevices
    allDevs = audio.get_devices()
  File "/usr/local/lib/python3.8/dist-packages/psychtoolbox/audio.py", line 70, in get_devices
    return PsychPortAudio('GetDevices', device_type, device_index);
Exception: PTB-ERROR: PortAudio can't detect any supported sound device on this system.
2.3410 	WARNING 	Speech-to-text recognition module not available (use command `pip install SpeechRecognition` to get it. Transcription will be unavailable.
2.3765 	WARNING 	We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).