Launch Error Mac

Hi,

PsychoPy used to work on my Mac. I saved an experiment and now I get this message whenever I try to open PsychoPy: Launch error
See the py2app website for debugging launch issues

Can anyone help me?

What version are you trying to launch?

Becca

Did anyone figure this out? I have tried 2022.2.4, 2022.2.3, 2022.2.2 using MacOS 10.95

If you’re using macos 10.9.5 I wonder if that’s just too old a version of the operating system (that was released 8 years ago). Certainly I don’t have a machine to test on with that version of macos.

But you might be able to get a more informative error message from PsychoPy error logging. Could you go to the terminal and do this:

cat ~/.psychopy3/last_app_load.log

Hi, same issue here: Just downloaded and installed the Standalone 2022.2.5. for macOS from Installation — PsychoPy v2023.1.0 and get the same launch error. My OS is 12.6.3 though, so I don’t think that’s too old.

And when you go to terminal and paste in
cat ~/.psychopy3/last_app_load.log
what does it say?

Basically, I can’t replicate this on my own mac computers (including one running MacOS 12.6) so we need more information to have a guess at what’s going wrong

I get this -Terry Acree M1 processor; running Mac OS 13.2.1 (with a separate install of Python 3.11.2)

/builder/builder.py", line 125, in <module>
    class BuilderFrame(BaseAuiFrame, handlers.ThemeMixin):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 128, in BuilderFrame
    routineTemplates = TemplateManager()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 110, in __init__
    self.updateTemplates()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 117, in updateTemplates
    thisExp = experiment.Experiment()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/_experiment.py", line 137, in __init__
    _settingsComp = getComponents(fetchIcons=False)['SettingsComponent']
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/__init__.py", line 218, in getComponents
    module = import_module(explicit_rel_path, package=pkg)
  File "importlib/__init__.pyc", line 127, in import_module
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/microphone/__init__.py", line 15, in <module>
    from psychopy.sound.audiodevice import sampleRateQualityLevels
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/sound/__init__.py", line 120, in <module>
    raise ValueError(msg)
ValueError: audioLib pref should be one of ['PTB', 'sounddevice', 'pyo', 'pysoundcard', 'pygame'], not "'PTB'"
terryeacree@dhcp-vl2042-25342 ~ %

@albietz in your case that looks like the prefs for your audio lib have been set incorrectly (using quotes that aren’t necessary)

Could you tell us:

  • what exact version of PsychoPy you’re using?
  • the output when you put this in the terminal:
    grep audio ~/.psychopy3/userPrefs.cfg

thanks

Blockquote 0.2577 DEBUG Opening message catalog /Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/localization/…/app/locale/en_US/LC_MESSAGE/messages.mo for locale en_US
Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/boot.py”, line 258, in
_run()
File “/Applications/PsychoPy.app/Contents/Resources/boot.py”, line 172, in _run
exec(compile(source, path, “exec”), globals(), globals())
File “/Applications/PsychoPy.app/Contents/Resources/psychopyApp.py”, line 102, in
main()
File “/Applications/PsychoPy.app/Contents/Resources/psychopyApp.py”, line 98, in main
start_app()
File “/Applications/PsychoPy.app/Contents/Resources/psychopyApp.py”, line 26, in start_app
app = startApp(showSplash=showSplash)
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/init.py”, line 84, in startApp
_psychopyApp = PsychoPyApp(
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/_psychopyApp.py”, line 236, in init
self.onInit(testMode=testMode, **kwargs)
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/_psychopyApp.py”, line 453, in onInit
from psychopy.app import coder, builder, runner, dialogs
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/init.py”, line 5, in
from .builder import BuilderFrame
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py”, line 125, in
class BuilderFrame(BaseAuiFrame, handlers.ThemeMixin):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py”, line 128, in BuilderFrame
routineTemplates = TemplateManager()
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py”, line 110, in init
self.updateTemplates()
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py”, line 117, in updateTemplates
thisExp = experiment.Experiment()
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/_experiment.py”, line 137, in init
_settingsComp = getComponents(fetchIcons=False)[‘SettingsComponent’]
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/init.py”, line 218, in getComponents
module = import_module(explicit_rel_path, package=pkg)
File “importlib/init.pyc”, line 127, in import_module
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/microphone/init.py”, line 15, in
from psychopy.sound.audiodevice import sampleRateQualityLevels
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/sound/init.py”, line 135, in
raise DependencyError(
psychopy.exceptions.DependencyError: No sound libs could be loaded. Tried: [‘pygame’]
Check whether the necessary sound libs are installed

I am running 2023.1.1, as per the tooltip and the version download.

What follows is the exact terminal output when I ran bulletpoint 2:

terryeacree@dhcp-vl2042-8338 ~ % grep audio ~/.psychopy3/userPrefs.cfg
    # choice of audio library
    audioLib = sounddevice, pyo, pygame
    # audio driver to use
    audioDriver = coreaudio, portaudio
    # audio device to use (if audioLib allows control)
    audioDevice = default,
    # path to flac (lossless audio compression) on this operating system
    # Google Cloud Platform key, required for the audio transcription using Google Speech Recognition. Specified as a path to a JSON file containing the key data.
    # choice of audio library
    audioLib = "'PTB'", sounddevice, pyo, pygame
    # audio driver to use
    audioDriver = coreaudio, portaudio
    # audio device to use (if audioLib allows control)
    audioDevice = default,
    # latency mode for PsychToolbox audio (3 is good for most applications. See
    audioLatencyMode = 3
terryeacree@dhcp-vl2042-8338 ~ % 

So @albietz in your case the problem is the line
audioLib = "'PTB'", sounddevice, pyo, pygame
Note the quotes around the PTB? They shouldn’t be there. You need to edit that file set that line to be
audioLib = PTB, sounddevice, pyo, pygame
I’m afraid I have no idea how it became like that but maybe someone added the quotes in your application prefs

@ASG in your case I think your preferences are set only to use pygame and that can no longer be packaged with MacOS standalone (when I last checked it failed to code-sign with the new MacOS gatekeeper)

So you also probably need to edit the file ~/.psychopy3/userPrefs.cfg and I would also recommend setting
audioLib = PTB, sounddevice

Thank you so much for looking into this, Jon!
I actually have had this problem on two iMacs, and after you said it was likely the audio preferences, I managed to fix it on one of them by going into an older version of PsychoPy (v3.2.4) that I had still on there and changing the audio library field under “Preferences” from [‘pygame’] to [‘pygame’,‘PTB’,‘sounddevice’]. After that, PsychoPy 2022.2.5 willingly launched on that machine.

My other machine didn’t have a prior version of PsychPy installed, so I tried the same workaround by installing v3.2.4 first to get to the preference settings. Alas, same launch error for that one. So I went back all the way to v.1.85.3, which did launch and let me change the audio library settings under Preferences, but unfortunately this time the workaround didn’t work.

This leaves me in the embarrassing position to ask you for more detailed guidance on how to change the preferences via the terminal. Apologies!

Anna

Anna, you need to find and edit or delete the file ~/.psychopy3/userPrefs.cfg

If you don’t want to use the command line then you just need to show your “hidden files” because any folder that starts with “.” is hidden by default. On MacOS in a Finder window go to your home folder and show hidden files, either from the menu or with Cmd-Shift-. shortcut keys then you should see .psychopy3 and inside that will be your userprefs file. Close PsychoPy, delete that file, and restart PsychoPy. Or just open it in a text editor and change the field manually

YES!!! That solved it! Thank you so much, you’re the best!

Just reporting that upgraded from PsychoPy v2022.2.5 on MacBook Pro (M1 Pro) to v2023.1.2 and I get the “Launch error” too, but thanks Jon, adding PTB to the userPrefs.cfg file fixed it!

Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/__boot__.py", line 258, in <module>
    _run()
  File "/Applications/PsychoPy.app/Contents/Resources/__boot__.py", line 172, in _run
    exec(compile(source, path, "exec"), globals(), globals())
  File "/Applications/PsychoPy.app/Contents/Resources/psychopyApp.py", line 102, in <module>
    main()
  File "/Applications/PsychoPy.app/Contents/Resources/psychopyApp.py", line 98, in main
    start_app()
  File "/Applications/PsychoPy.app/Contents/Resources/psychopyApp.py", line 26, in start_app
    app = startApp(showSplash=showSplash)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/__init__.py", line 84, in startApp
    _psychopyApp = PsychoPyApp(
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/_psychopyApp.py", line 236, in __init__
    self.onInit(testMode=testMode, **kwargs)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/_psychopyApp.py", line 453, in onInit
    from psychopy.app import coder, builder, runner, dialogs
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/__init__.py", line 5, in <module>
    from .builder import BuilderFrame
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 125, in <module>
    class BuilderFrame(BaseAuiFrame, handlers.ThemeMixin):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 128, in BuilderFrame
    routineTemplates = TemplateManager()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 110, in __init__
    self.updateTemplates()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py", line 117, in updateTemplates
    thisExp = experiment.Experiment()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/_experiment.py", line 137, in __init__
    _settingsComp = getComponents(fetchIcons=False)['SettingsComponent']
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/__init__.py", line 218, in getComponents
    module = import_module(explicit_rel_path, package=pkg)
  File "importlib/__init__.pyc", line 127, in import_module
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/microphone/__init__.py", line 15, in <module>
    from psychopy.sound.audiodevice import sampleRateQualityLevels
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/sound/__init__.py", line 135, in <module>
    raise DependencyError(
psychopy.exceptions.DependencyError: No sound libs could be loaded. Tried: ['sounddevice', 'pyo', 'pygame']
Check whether the necessary sound libs are installed```
type or paste code here

Hello, I am using Macbook Air M1, trying to use the Psychopy version 2023.1.2, and I tried to run simple task, it is not working.
I tried to edit the file you mentioned, it was already as same text you mentioned. It’s my first time using Psychopy, I appreciate your assistance.

Generating PsychoPy script...

## Running: /Users/negar/Documents/Psychopy_experiments/Course_practice/test/untitled_lastrun.py ##
33.4112     INFO     Loaded monitor calibration from ['2023_05_24 04:44']
2023-05-24 17:13:20.826 python[2458:105859] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/7x/32w0fd1s5nb5v98lwqzkbp900000gn/T/org.opensciencetools.psychopy.savedState
8.0451     WARNING     Couldn't measure a consistent frame rate!
Traceback (most recent call last):
  - Is your graphics card set to sync to vertical blank?
  - Are you running other processes on your computer?

8.9615     WARNING     Couldn't measure a consistent frame rate!
  - Is your graphics card set to sync to vertical blank?
  - Are you running other processes on your computer?

9.0181     WARNING     launchHubServer: If using the iohub mouse or eyetracker devices, fullScr should be True.
ioHub Server Process Completed With Code:  Negsignal.SIGSEGV
  File "/Users/negar/Documents/Psychopy_experiments/Course_practice/test/untitled_lastrun.py", line 97, in <module>
    ioServer = io.launchHubServer(window=win, **ioConfig)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/contrib/lazy_import.py", line 118, in __call__
    return obj(*args, **kwargs)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/connect.py", line 256, in launchHubServer
    return ioHubConnection(iohub_config)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/__init__.py", line 296, in __init__
    raise RuntimeError('Error starting ioHub server: {}'.format(self.iohub_status))
RuntimeError: Error starting ioHub server: ioHub startup failed.
################# Experiment ended with exit code 1 [pid:2458] #################
## Running: /Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/__init__.py ##
Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/__init__.py", line 21, in <module>
    from ..lazy_import import lazy_import
ImportError: attempted relative import with no known parent package
################# Experiment ended with exit code 1 [pid:2480] #################
Generating PsychoPy script...

## Running: /Users/negar/Documents/Psychopy_experiments/Course_practice/test/untitled_lastrun.py ##
798.1542     INFO     Loaded monitor calibration from ['2023_05_24 04:44']
2023-05-24 17:26:07.067 python[2683:117916] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/7x/32w0fd1s5nb5v98lwqzkbp900000gn/T/org.opensciencetools.psychopy.savedState
973.2542     WARNING     Couldn't measure a consistent frame rate!
Traceback (most recent call last):
  - Is your graphics card set to sync to vertical blank?
  - Are you running other processes on your computer?

974.1442     WARNING     t of last frame was 23.38ms (=1/42)
974.1871     WARNING     Couldn't measure a consistent frame rate!
  - Is your graphics card set to sync to vertical blank?
  - Are you running other processes on your computer?

974.2341     WARNING     launchHubServer: If using the iohub mouse or eyetracker devices, fullScr should be True.
ioHub Server Process Completed With Code:  Negsignal.SIGSEGV
  File "/Users/negar/Documents/Psychopy_experiments/Course_practice/test/untitled_lastrun.py", line 97, in <module>
    ioServer = io.launchHubServer(window=win, **ioConfig)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/contrib/lazy_import.py", line 118, in __call__
    return obj(*args, **kwargs)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/connect.py", line 256, in launchHubServer
    return ioHubConnection(iohub_config)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/__init__.py", line 296, in __init__
    raise RuntimeError('Error starting ioHub server: {}'.format(self.iohub_status))
RuntimeError: Error starting ioHub server: ioHub startup failed.
################# Experiment ended with exit code 1 [pid:2683] #################
Generating PsychoPy script...

## Running: /Users/negar/Documents/Psychopy_experiments/Course_practice/test/untitled_lastrun.py ##
2023-05-24 17:43:27.759 python[2901:126878] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/7x/32w0fd1s5nb5v98lwqzkbp900000gn/T/org.opensciencetools.psychopy.savedState
7.9925     WARNING     Couldn't measure a consistent frame rate!
Traceback (most recent call last):
  - Is your graphics card set to sync to vertical blank?
  - Are you running other processes on your computer?

8.9095     WARNING     Couldn't measure a consistent frame rate!
  - Is your graphics card set to sync to vertical blank?
  - Are you running other processes on your computer?

8.9695     WARNING     launchHubServer: If using the iohub mouse or eyetracker devices, fullScr should be True.
ioHub Server Process Completed With Code:  Negsignal.SIGSEGV
  File "/Users/negar/Documents/Psychopy_experiments/Course_practice/test/untitled_lastrun.py", line 97, in <module>
    ioServer = io.launchHubServer(window=win, **ioConfig)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/contrib/lazy_import.py", line 118, in __call__
    return obj(*args, **kwargs)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/connect.py", line 256, in launchHubServer
    return ioHubConnection(iohub_config)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/iohub/client/__init__.py", line 296, in __init__
    raise RuntimeError('Error starting ioHub server: {}'.format(self.iohub_status))
RuntimeError: Error starting ioHub server: ioHub startup failed.
################# Experiment ended with exit code 1 [pid:2901] #################

well, I used the 2021.1.2 version instead of 2023 one, and it worked with the local version however it doesn’t still working for online version.

I am using macos venture and Macbook air 2020 M1

Traceback (most recent call last):
  File “urllib3/connectionpool.pyc”, line 384, in _make_request
  File “<string>”, line 2, in raise_from
  File “urllib3/connectionpool.pyc”, line 380, in _make_request
  File “http/client.pyc”, line 1331, in getresponse
  File “http/client.pyc”, line 297, in begin
  File “http/client.pyc”, line 258, in _read_status
  File “socket.pyc”, line 586, in readinto
  File “urllib3/contrib/pyopenssl.pyc”, line 298, in recv_into
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/requests/adapters.py”, line 449, in send
  File “urllib3/connectionpool.pyc”, line 638, in urlopen
  File “urllib3/util/retry.pyc”, line 367, in increment
  File “urllib3/packages/six.pyc”, line 686, in reraise
  File “urllib3/connectionpool.pyc”, line 600, in urlopen
  File “urllib3/connectionpool.pyc”, line 386, in _make_request
  File “urllib3/connectionpool.pyc”, line 306, in _raise_timeout
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘gitlab.pavlovia.org’, port=443): Read timed out. (read timeout=3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/pavlovia_ui/project.py”, line 151, in submitChanges
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/projects/pavlovia.py”, line 325, in createProject
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/exceptions.py”, line 251, in wrapped_f
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/mixins.py”, line 204, in create
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/__init__.py”, line 604, in http_post
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/__init__.py”, line 481, in http_request
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/requests/sessions.py”, line 646, in send
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/requests/adapters.py”, line 529, in send
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host=‘gitlab.pavlovia.org’, port=443): Read timed out. (read timeout=3)