Library not loaded on MacOS Mojave

Hi everyone,

OS: MacOS Mojave 10.14.6
PsychoPy version: v2022.2.4
Standard Standalone? (y/n): yes

The experiment works well on Windows 10 and on MacOS Catalina 10.15.7 for the same version (2022.2.4), but unfortunately I have to run it on another computer (MacOS Mojave 10.14.6). It seems that PsychoPy cannot load some libraries (see “ImportError” lines):

2231.5694     INFO     Loaded monitor calibration from ['2022_09_26 16:14']
2022-09-26 18:26:27.994 python[1169:41216] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
1.4794     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).
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/voicekey/__init__.py", line 18, in <module>
    import pyo64 as pyo
  File "<frozen zipimport>", line 259, in load_module
  File "pyo64/__init__.pyc", line 31, in <module>
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/__init__.py", line 27, in <module>
    from .lib import analysis as analysis
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/lib/analysis.py", line 32, in <module>
    from ._core import *
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/lib/_core.py", line 63, in <module>
    from .._pyo64 import *
ImportError: dlopen(/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/_pyo64.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libportaudio.2.dylib
  Referenced from: /Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/_pyo64.cpython-38-darwin.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/petra/Desktop/Expé AFG/Tache_experimentale/Tache_experimentale_lastrun.py", line 100, in <module>
    import psychopy.voicekey as vk
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/voicekey/__init__.py", line 21, in <module>
    import pyo
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/__init__.py", line 27, in <module>
    from .lib import analysis as analysis
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/lib/analysis.py", line 32, in <module>
    from ._core import *
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/lib/_core.py", line 63, in <module>
    from .._pyo64 import *
ImportError: dlopen(/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/_pyo64.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libportaudio.2.dylib
  Referenced from: /Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/_pyo64.cpython-38-darwin.so
  Reason: image not found
################# Experiment ended with exit code 1 [pid:1169] #################

Thanks in advance! :pray:

We finally managed to made it work, here are the steps we followed:

  1. copy/paste libportaudio.2.dylib file* into /Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/ ==> it didn’t work but we had a different error message indicating that another library wasn’t loaded: @loader_path/libportmidi.dylib
  2. copy/paste libportmidi.dylib file* into /Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyo/ ==> it worked!

*Note: we copied the absent files from the other mac (MacOS Catalina 10.15.7) on which there were present and on which the experiment worked. The files were in /usr/local/Cellar/portaudio/19.20140130/lib/libportaudio.2.dylib and /usr/local/Cellar/portaudio/19.20140130/lib/libportaudio.dylib. You could either download them online.

Hi AFG,

I’m just curious if you ever found a patch for this aside from what you described above? I’m running PsychoPy on a Monterey OS macbook pro and run into a similar issue when trying to use the voicekey function to calculate naming response times.

Thanks!
FG

Hi Franck,
No, I only used the above solution and no other patch. Did you try it? I’m not sure my instructions were clear enough, so don’t hesitate to ask me to specify.
AFG