Audio error but no audio in task

Hello,
Any help with this problem would be greatly appreciated! I downloaded PsychoPy on a new desktop and tried to run a task, but received the error below about audio libraries. However, my task does not have any need for an audio library or sound. Is there a way to get around this error so that my task will run? See error below:

2.0132 ERROR Failed to load any of the audioLibs: [‘ptb’]. Falling back to PsychToolbox (‘ptb’) backend for sound. Be sure to add ‘ptb’ to preferences to avoid seeing this message again.

Traceback (most recent call last):

2.0173 ERROR No audioLib could be loaded. Tried: [‘ptb’]

Check whether the necessary audioLibs are installed.

File “/Users/johnw/Downloads/Allison_RFT_task/FINAL_RFT_Task_Updated2025-02-18-25_lastrun.py”, line 25, in

from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layout, hardware

File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/sound/init.py”, line 262, in

raise ImportError("None of the audio library backends could be imported. "

ImportError: None of the audio library backends could be imported. Tried: [‘ptb’]

Check whether the necessary audioLibs are installed and can be imported successfully.

################# Experiment ended with exit code 1 [pid:8031] #################

**PsychoPy version: 2024.2.4 Py 3.8
**Standard Standalone Installation? Yes
**Do you want it to also run online? Yes

Thanks in advance!

1 Like

Try changing the sound library from Experiment Settings / Audio

I tried changing the audio in experiment settings and tried all four audio settings (ptb, pyo, sounddevice, and pygame) and still get the same error.

My task does not use any audio (text and key responses only), so I’m not sure why it’s calling for audio and failing to run for that reason.

MacOS Sierra on a mac desktop with PsychoPy version v2024.2.4.

I’m having this exact same issue. I just installed on my lab Macs and can’t run any task of any kind because of this error. If anyone knows the fix, it would be really helpful right now. I didn’t have to install anything extra on my PC laptop to run things, so I have no idea what’s going wrong.

Hi all, just wanted to share a solution that finally worked for me in case it helps others!

I was running into persistent errors with PsychoPy’s audio backends (e.g., sounddevice, pyo, and even ptb) on my MacBook, and none of the audio libraries would load properly — even though my task didn’t always use audio. The task would crash or hang regardless.

I’m on a 2022 MacBook Air with the M2 chip (macOS Monterey), and it turned out to be a compatibility issue between my system and newer versions of PsychoPy + NumPy.

Here’s what versions worked for me:

Use these specific versions:

  • Python: 3.9.6
  • NumPy: 1.26.4
  • PsychoPy: 2023.2.3 (installed via pip)

You can create a virtual environment and install exact versions like this:

python3.9 -m venv .venv
source .venv/bin/activate
pip install numpy==1.26.4 psychopy==2023.2.3

In my case, I also had to update the import in run.py:

from experiments.example_experiment import constants as const

Instead of importing from the top-level folder.

Once I did all of the above, the audio playback worked!

I also used the pygame backend for audio in the end (you may see a warning about PTB being better but it works fine for me).

tl:dr just change around the versions of psychopy and other packages to see if it is compatible

Hope this helps anyone else working on an Apple Silicon Mac and running into similar headaches!