PsychoPy not starting in virtual environment

Hi there

We are using PsychoPy 2022.1.1 for our fMRI experiments. Some time ago, we followed the installation guide from PsychoPy (Installation — PsychoPy v2023.1.2) to install a virtual environment with this specific version of PsychoPy.

We used the following settings in the environment file:
name: psychopy
channels:

  • conda-forge
    dependencies:
  • python=3.8
  • psychopy=2022.1.1
  • pip
  • pip:
    • psychtoolbox
    • pygame
    • pyo
    • pyparallel; platform_system != “Windows”
    • SoundFile; platform_system == “Windows”
    • websocket_client

Initially, everything was working fine, but within the past two weeks, we have encountered an issue. Although we can activate the virtual environment, as soon as we try to open PsychoPy within the environment, the splash image appears briefly, followed by an immediate shutdown of PsychoPy. We have checked the conda prompt for any error messages, but none are displayed. Despite attempting to reinstall the entire environment, the problem persists. We are currently at a loss as to where to look for the source of this problem.

If anyone has any tips or suggestions on where to investigate or how to troubleshoot this issue, we would greatly appreciate the assistance.

Many thanks in advance

Nina

You could check the log file - when the crash happens from the app starting, sometimes error messages are swallowed up before they make it to the console, but they still appear in the log file. It’ll be in your AppData folder, on Windows it’s:
"%AppData%/psychopy3/last_app_load.log

Thanks!

We found the error message, which was

File “D:\conda_envs\env_CBC_old\lib\subprocess.py”, line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden
49.6701 ERROR Package jedi not installed, code auto-completion and calltips will not be available.

Which is a bit weird since ‘jedi’ was never installed as a package in the environment even when PsychoPy was still running. Anyway, we then installed the package and after that the error messag is this:

File “D:\conda_envs\env_viwotrain\lib\subprocess.py”, line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden
(Translation: FileNotFoundError: [WinError 2] The system cannot find the specified file.)

But we are not sure which file it can’t find because the subprocesses.py is in the folder where it is specified before the error message.

Also, the same error message occurs when trying to install packages in PyCharm. Therefore, we assume that this is more a global problem and not a problem related to PsychPy or the virtual environment. But we still don’t know where to look for the problem.

Best wishes,

Nina

complete logfile

pygame 2.1.2 (SDL 2.0.18, Python 3.8.13)
Hello from the pygame community. Contribute - pygame wiki
D:\conda_envs\env_viwotrain\lib\site-packages\pyglet\media\codecs\wmf.py:838: UserWarning: [WinError -2147417850] Der Threadmodus kann nicht nach dem Einstellen geändert werden
warnings.warn(str(err))
PTB-INFO: Using modified PortAudio V19.7.0-devel, revision unknown
2.4906 DEBUG Opening message catalog D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\localization..\app\locale\de_CH\LC_MESSAGE\messages.mo for locale de_CH
2.4909 DEBUG Locale for ‘de_CH’ not found. Using default.
41.4017 WARNING Speech-to-text recognition module for PocketSphinx is not available (use command pip install SpeechRecognition to get it). Transcription will be unavailable using that service this session.
41.4028 WARNING Speech-to-text recognition using Google online services is not available (use command pip install google-api-core google-auth google-cloud google-cloud-speech googleapis-common-protos to get it). Transcription will be unavailable using that service this session.
41.5574 INFO Loaded SoundDevice with PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4
41.5575 INFO sound is using audioLib: sounddevice
41.5575 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).
Traceback (most recent call last):
File “D:\conda_envs\env_viwotrain\Scripts\psychopy-script.py”, line 10, in
sys.exit(main())
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\psychopyApp.py”, line 98, in main
start_app()
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\psychopyApp.py”, line 26, in start_app
app = startApp(showSplash=showSplash)
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app_init_.py”, line 64, in startApp
psychopyApp = PsychoPyApp(
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app_psychopyApp.py”, line 215, in init
self.onInit(testMode=testMode, **kwargs)
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app_psychopyApp.py”, line 265, in onInit
from psychopy.app import coder, builder, runner, dialogs
File "D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\builder_init
.py", line 5, in
from .builder import BuilderFrame
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\builder\builder.py”, line 120, in
class BuilderFrame(wx.Frame, ThemeMixin):
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\builder\builder.py”, line 123, in BuilderFrame
routineTemplates = TemplateManager()
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\builder\builder.py”, line 105, in init
self.updateTemplates()
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\app\builder\builder.py”, line 112, in updateTemplates
thisExp = experiment.Experiment()
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\experiment_experiment.py”, line 137, in init
self.settings = settingsComp(parentName=‘’, exp=self)
File "D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\experiment\components\settings_init
.py", line 200, in init
allowedVals=versions._versionFilter(versions.versionOptions(), wx.version)
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\tools\versionchooser.py”, line 215, in versionOptions
for v in availableVersions(local=local)}),
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\tools\versionchooser.py”, line 300, in availableVersions
return _localVersions(forceCheck)
File “D:\conda_envs\env_viwotrain\lib\site-packages\psychopy\tools\versionchooser.py”, line 230, in _localVersions
tagInfo = subprocess.check_output(cmd.split(), cwd=VERSIONSDIR,
File “D:\conda_envs\env_viwotrain\lib\subprocess.py”, line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “D:\conda_envs\env_viwotrain\lib\subprocess.py”, line 493, in run
with Popen(*popenargs, **kwargs) as process:
File “D:\conda_envs\env_viwotrain\lib\subprocess.py”, line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “D:\conda_envs\env_viwotrain\lib\subprocess.py”, line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden