Multiple users are having problems with libraries

Hello all.

I am teaching the new PsychoPy book (which is great b.t.w.) in a course with around 100 students. Several users, mostly Mac users, are running into problems when running PsychoPy. They cannot even run the simplest experiment, e.g. showing a default text component for 1 second. It seems like a common theme is that libraries are missing. Several students have tried more than one version of PsychoPy (e.g. 1.90.1 and 1.90.3) and several have also tried both Python 2 and Python 3 versions (standalone). I am at a loss, so below are some error messages from four users – but more had issues (e.g. a Windows user had an apparent problem with a different library). Any help would be greatly appreciated.

----- USER 1 -----
Macbook Pro, OS X El Capitan version 10.11.6

########## Running: /Users/Inga/Documents/PsychoPy/stroop_lastrun.py ########### Traceback (most recent call last):
File “/Users/Inga/Documents/PsychoPy/stroop_lastrun.py”, line 14, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
File “/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/init.py”, line 79, in
from . import backend_sounddevice as backend
File “/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/backend_sounddevice.py”, line 20, in
import soundfile as sf
File “soundfile/init.pyc”, line 1, in
File “soundfile/soundfile.pyc”, line 270, in
File “/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/cffi/api.py”, line 141, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File “/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/cffi/api.py”, line 802, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File “/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/cffi/api.py”, line 797, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library ‘/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib’: dlopen(/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib, 2): no suitable image found. Did find:
/Volumes/PsychoPy/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 ‘/Volumes/PsychoPy/PsychoPy2.app/Contents/Resources/lib/python2.7/site-packages.zip/soundfile/_soundfile_data/libsndfile.dylib’

----- USER 2 -----
Mac Os High Sierra, version 10.9.5

######## Running: /Users/gunnhildurgunnarsdottir/Desktop/sss_lastrun.py ######## Traceback (most recent call last):
File “soundfile.pyc”, line 142, in
OSError: sndfile library not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/gunnhildurgunnarsdottir/Desktop/sss_lastrun.py”, line 14, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/sound/init.py”, line 79, in
from . import backend_sounddevice as backend
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/sound/backend_sounddevice.py”, line 20, in
import soundfile as sf
File “”, line 961, in _find_and_load
File “”, line 950, in _find_and_load_unlocked
File “”, line 646, in _load_unlocked
File “”, line 616, in _load_backward_compatible
File “soundfile.pyc”, line 156, in
File “posixpath.pyc”, line 78, in join
TypeError: expected str, bytes or os.PathLike object, not list

----- USER 3 -----
Unknown operating system

######### Running: /Users/karengeirsdottir/Documents/stroop_lastrun.py ######### Traceback (most recent call last):
File “/Users/karengeirsdottir/Documents/stroop_lastrun.py”, line 14, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/init.py”, line 79, in
from . import backend_sounddevice as backend
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/backend_sounddevice.py”, line 20, in
import soundfile as sf
File “soundfile/init.pyc”, line 1, in
File “soundfile/soundfile.pyc”, line 270, in
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’

----- USER 4 -----
MacBook pro, Unknown operating system

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’

Sorry to hear that this caused a problem for a classroom (or at all!)

There was a persistent and nasty packaging problem with one of the sound libraries (it kept looking like it was fixed but then broke again). I’m pretty confident it is now fixed in the 3.0.0b9 beta release so your students could try that or alternatively tell PsychoPy to use a different sound lib by changing the application preferences to this:

['pyo', u'sounddevice', u'pygame', ]

or even just

['pyo']

rather than:

[u'sounddevice', u'pygame', ]

The key is to get PsychoPy to ignore the sounddevice library and use one of the other options.

Hope that gets you running.

If you manage to find out more about this one then let us know

best wishes
Jon

1 Like

Thank you so much. The Windows user (I think) had the following error message:

Running: /Users/gunnhildurgunnarsdottir/Desktop/stroop_lastrun.py ####### pyo version 0.8.8 (uses single precision) Traceback (most recent call last):

File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/gui/qtgui.py”, line 15, in
from PyQt4 import QtGui as QtWidgets # in qt4 these were all in
one package
ModuleNotFoundError: No module named ‘PyQt4’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/gunnhildurgunnarsdottir/Desktop/stroop_lastrun.py”, line 14, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/gui/init.py”, line 33, in
from .qtgui import *
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/gui/qtgui.py”, line 18, in
from PyQt5 import QtWidgets
ImportError: dlopen(/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/PyQt5/QtWidgets.so, 2): Symbol not found: _LSCopyDefaultApplicationURLForURL
Referenced from: /Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
Expected in:
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServi
ces in
/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/PyQt5/Qt/
lib/QtCore.framework/Versions/5/QtCore

B.t.w. your original solution has worked for some of my students. Here is one that said it didn’t work. Windows of unknown version, PsychoPy 1.90.3:

Running: C:\Users\Liina Björg\Documents\Psychopy_tilraunir\prufa2.py ##### Traceback (most recent call last):

File "C:\Users\Liina Björg\Documents\PsychoPy\PsychoPy2_PY3\lib\site-packages\sounddevice.py", line 64, in <module>

raise OSError(‘PortAudio library not found’)

OSError: PortAudio library not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\Liina Björg\Documents\Psychopy_tilraunir\prufa2.py", line 14, in <module>

from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock

File "C:\Users\Liina Björg\Documents\PsychoPy\PsychoPy2_PY3\lib\site-packages\psychopy\sound_init_.py", line 79, in <module>

from . import backend_sounddevice as backend

File "C:\Users\Liina Björg\Documents\PsychoPy\PsychoPy2_PY3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 19, in <module>

import sounddevice as sd

File "C:\Users\Liina Björg\Documents\PsychoPy\PsychoPy2_PY3\lib\site-packages\sounddevice.py", line 75, in <module>

‘portaudio-binaries’, _libname))

OSError: cannot load library ‘C:\Users\Liina Björg\Documents\PsychoPy\PsychoPy2_PY3\lib\site-packages_sounddevice_data\portaudio-binaries\libportaudio32bit.dll’: error 0x7e