Error in Mac when running experiment: Failed to load component package `sound`

If this template helps then use it. If not then just delete and start from scratch.

macOS High Sierra (e.g. macOS):
PsychoPy version 2022.1.2
Standard Standalone? (y): StandalonePsychoPy-2022.1.2-macOS

When clicking on “Run experiment” in the builder, I get the following error message:

21.7295 ERROR Failed to load component package sound. Does it have a __init__.py?
21.7715 ERROR Failed to load component package sound. Does it have a __init__.py?
21.8177 ERROR Failed to load component package sound. Does it have a __init__.py?
21.8704 ERROR Failed to load component package sound. Does it have a __init__.py?
21.8953 WARNING image was set to update during ISI_load_images Static Component, but that component no longer exists
21.8954 WARNING image was set to update during ISI_load_images Static Component, but that component no longer exists
21.8954 WARNING image was set to update during ISI_load_images Static Component, but that component no longer exists
21.8954 WARNING image was set to update during ISI_load_images Static Component, but that component no longer exists
21.8954 WARNING image was set to update during ISI_load_images Static Component, but that component no longer exists
21.9355 ERROR Failed to load component package sound. Does it have a __init__.py?
21.9785 ERROR Failed to load component package sound. Does it have a __init__.py?
22.0117 ERROR Failed to load component package sound. Does it have a __init__.py?
22.0582 ERROR Failed to load component package sound. Does it have a __init__.py?
22.2626 DEBUG PavloviaLoggedIn
22.7046 ERROR Failed to load component package sound. Does it have a __init__.py?
22.7437 ERROR Failed to load component package sound. Does it have a __init__.py?
22.9243 ERROR Failed to load component package sound. Does it have a __init__.py?
22.9645 ERROR Failed to load component package sound. Does it have a __init__.py?
23.1138 ERROR Failed to load component package sound. Does it have a __init__.py?
23.1522 ERROR Failed to load component package sound. Does it have a __init__.py?
23.1613 INFO Loaded monitor calibration from [‘2022_03_25 10:13’]
26.0933 WARNING Couldn’t connect to psychopy.org
Check internet settings (and proxy setting in PsychoPy Preferences.
Generating PsychoPy script…

Running: /Users/mbpuser/Documents/TFG_2022/Proyecto_beatriz/tentativa1_lastrun.py

31.0868 ERROR Failed to load component package sound. Does it have a __init__.py?
31.1274 ERROR Failed to load component package sound. Does it have a __init__.py?
31.1315 INFO Loaded monitor calibration from [‘2022_03_25 10:13’]
31.1694 ERROR Failed to load component package sound. Does it have a __init__.py?
31.2104 ERROR Failed to load component package sound. Does it have a __init__.py?
1.2813 WARNING The ‘psychtoolbox’ library cannot be loaded but is required for audio capture (use pip install psychtoolbox to get it). Microphone recording will be unavailable this session. Note that opening a microphone stream will raise an error.
Traceback (most recent call last):
File “/Users/mbpuser/Documents/TFG_2022/Proyecto_beatriz/tentativa1_lastrun.py”, line 16, in
from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layout
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/sound/init.py”, line 45, in
from .transcribe import * # import transcription engine stuff
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/sound/transcribe.py”, line 58, in
import pocketsphinx
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pocketsphinx/init.py”, line 35, in
from sphinxbase import *
File “”, line 259, in load_module
File “sphinxbase/init.pyc”, line 37, in
File “”, line 259, in load_module
File “sphinxbase/ad_openal.pyc”, line 27, in
File “”, line 259, in load_module
File “sphinxbase/_ad_openal.pyc”, line 14, in
File “sphinxbase/_ad_openal.pyc”, line 10, in __load
File “imp.pyc”, line 342, in load_dynamic
ImportError: dlopen(/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/lib-dynload/sphinxbase/_ad_openal.so, 2): Symbol not found: ____chkstk_darwin
Referenced from: /Applications/PsychoPy.app/Contents/MacOS/…/Frameworks/libopenal.1.21.1.dylib (which was built for Mac OS X 11.0)
Expected in: /usr/lib/libSystem.B.dylib
in /Applications/PsychoPy.app/Contents/MacOS/…/Frameworks/libopenal.1.21.1.dylib
################# Experiment ended with exit code 1 [pid:734] ##################

I’ve tried deleting any other folders with psychtoolbox in on my computer because I thought multiple directories might be confusing psychopy (giving that it’s having a problem finding the “sound” folder?). I tried the manual installation too but got lost as I am unfamiliar with python etc. I also have seen similar posts in this forum with similar errors, but I simply lack the psychopy knowledge to use them to fix my situation.

Any help whatsoever would be greatly appreciated.

Regards,

Hi @hta17,

Would you mind attaching your .psyexp file here for us to take a look at?

Also, could you just confirm that you have PsychoPy added and ticked in: Security & Privacy (on your Mac) > Accessibility and also Input Monitoring?

Thanks,

Kim

Hi Kim,

Here you have a .psyexp file attached

Also, I have PsychoPy added and ticked in: Security & Privacy (on your Mac) > Accessibility, but in my Security & Privacy I have no “Input monitoring”, maybe I am missing something… (my computer
practica 1_version2.psyexp (58.3 KB)
is macOS high sierra 10.13.6)

By the way, this file runs on other non-mac computers without any problems.

Regards,

Hi @hta17,

Thanks so much for this! Also thanks for clarifying that this works on non-Macs. So, Input Monitoring should be located just beneath Accessibility, as in this screenshot:
image

This is something that may be occurring in post-2020 Macs. If you could go to About this Mac, and on the box where you can see all of the information about your Mac (such as display, processor etc.), do you see a ‘chip’ field like this one (not necessarily with the same information in that field):

image

Thanks!

Kim

Hi again @hta17,

I have seen a few Mac users on the forum having a similar issue which should be fixed in the next bug release. A workaround can be found in this post. The file that is referred to in this post can be found by navigating to:

Finder > Applications > PsychoPy > Right click > Show package contents > Contents > Resources > lib > python3.8 > psychopy > sound > __init.py__

When you’ve found and opened the file (you can just open it in the Coder window of PsychoPy), just search for the following:

from .transcribe import *

It’s that line that you’ll be adding the extra lines of code around. So in the end that line will look like this:

try:
    from .transcribe import * # import transcription engine stuff
except ImportError:
    pass

Hope this helps!

Kim

Hi again Kim,

Thanks for your great instructions. Unfortunately the work around didn’t work… But I must say that now it’s not crucial that this version works on my computer as version 2021.2.3 seems to work fine, and I’m only running a simple behavioural experiment.

Anyways, the mac I’m working on is very old (late 2011), so maybe that’s why there’s no input monitoring option?
Screen Shot 2022-04-07 at 18.59.18

Regards,