Unable to run demo "voiceCapture" on Psychopy 3.2.3

OS (e.g. Win10): Mojave 10.14.6
PsychoPy version (e.g. 1.84.x): v3.2.3
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?: Trying to work with a microphone, first step testing the voiceCapture demo, getting error messages

What did you try to make it work?: change audiolib to various options, re-install Psychopy, test on a PC, where I do not get the same errors (but currently sorting out mic hardware issues there)

What specifically went wrong when you tried that?:

Generating PsychoPy script...
## Running: /Users/alario/Documents/TestingPsychoPy/demos/voiceCapture/voiceCapture_lastrun.py ##
0.0737     WARNING     pyo audio lib was requested but not loaded: ImportError('dlopen(/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lib-dynload/pyo/_pyo.so, 2): Library not loaded: @loader_path/libportaudio.2.dylib\n  Referenced from: /Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lib-dynload/pyo/_pyo.so\n  Reason: image not found',)
2019-10-07 16:28:46.105 python[4666:118603] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/sound/backend_pyo.py", line 19, in <module>
    import pyo
  File "pyo/__init__.pyc", line 28, in <module>
  File "pyo/lib/analysis.pyc", line 32, in <module>
  File "pyo/lib/_core.pyc", line 58, in <module>
  File "pyo/_pyo.pyc", line 14, in <module>
  File "pyo/_pyo.pyc", line 10, in __load
  File "imp.pyc", line 342, in load_dynamic
ImportError: dlopen(/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lib-dynload/pyo/_pyo.so, 2): Library not loaded: @loader_path/libportaudio.2.dylib
  Referenced from: /Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lib-dynload/pyo/_pyo.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/alario/Documents/TestingPsychoPy/demos/voiceCapture/voiceCapture_lastrun.py", line 18, in <module>
    from psychopy import sound, gui, visual, core, data, event, logging, clock, microphone
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/microphone.py", line 45, in <module>
    from psychopy.sound import backend_pyo
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/sound/backend_pyo.py", line 23, in <module>
    raise exceptions.DependencyError(repr(err))
psychopy.exceptions.DependencyError: ImportError('dlopen(/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lib-dynload/pyo/_pyo.so, 2): Library not loaded: @loader_path/libportaudio.2.dylib\n  Referenced from: /Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lib-dynload/pyo/_pyo.so\n  Reason: image not found',)

Thank you very much for your help, Xavier

Hello again

  1. With the help of more expert user, we have not been able to get around the problem.

We suspect a problem with the unavailability of

@loader_path/libportaudio.2.dylib

but because a standalone is offered for OSx I do not understand why this file is missing and/or how to install it.

  1. I have been able to reproduce the same behavior and same error message on a fresh install of 3.2.2 on different (desktop) Mac also running OSX 10.14.6.

  2. I have installed Release 1.90.3 but there too the demo does not run (perhaps this is not surprising) and I get another error message:


 Running: /Users/alario/DataPartition/PsychoPy_Demosv1.90.3/voiceCapture/voiceCapture_lastrun.py 
Traceback (most recent call last):
  File "/Users/alario/DataPartition/PsychoPy_Demosv1.90.3/voiceCapture/voiceCapture_lastrun.py", line 14, in <module>
    from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock, microphone
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/__init__.py", line 79, in <module>
    from . import backend_sounddevice as backend
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/backend_sounddevice.py", line 20, in <module>
    import soundfile as sf
  File "soundfile/__init__.pyc", line 1, in <module>
  File "soundfile/soundfile.pyc", line 270, in <module>
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/cffi/api.py", line 141, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/cffi/api.py", line 802, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/cffi/api.py", line 797, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library '/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib': dlopen(/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib, 2): no suitable image found.  Did find:
    /Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib: stat() failed with errno=20.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib'

Any help still much appreciated…

Trying the same demo on a PC (Windows 10 Pro)

It run smoothly once, but then upon being re-run (several times) it started to generate this apparently infinite loop:

Rebooting the PC did not help… Thanks again

I’m having the same problem, found in several different posts: