RuntimeError: Wrong version of PyObjC C API with added Python package (godirect) and Builder components

Hi everyone,

I’m working on integrating a Vernier dynamometer (Go Direct® Hand Dynamometer - Vernier) into a PsychoPy experiment and have run into a package conflict that I’m hoping someone can help me solve.

My Setup:

  • PsychoPy Version: 2024.2.4
  • Operating System: macOS Sequoia 15.4.1 but has to ultimately also run on a windows
  • External Package: I’ve installed the godirect package using pip (via the builder) into PsychoPy’s Python environment to communicate with the dynamometer.
  • Experiment: The experiment is built entirely in the Builder view.

The Problem:
My custom code component that uses the godirect library to initialize the dynamometer and collect data works perfectly fine on its own. However, as soon as I add a standard PsychoPy component that has a GUI element, like a Button Component, the experiment fails.

This happens whether the button routine is placed before or after the dynamometer routine. The specific error I receive, when I use the dynamometer first, is:
RuntimeError: Wrong version of PyObjC C API (got 25, expected 21)

This suggests there’s a conflict between the version of the mac-specific PyObjC library required by godirect (or one of its dependencies) and the version used by PsychoPy’s internal components.

What I Have Tried:

  1. Reordering Routines: I’ve tried placing the button routine before the dynamometer routine and vice-versa. The error still occurs.
  2. Package Versions: I am using the latest godirect version. I downgraded it to a earlier version but this did not help. Our lab would also strongly prefer to stick with PsychoPy 2024.2.4 for consistency across studies.
  3. Coder vs. Builder: I would much prefer to solve this within the Builder to save time, as the rest of the experiment is already set up there. However, I can switch to a pure code (and conda environment) solution if that’s the only way forward.

Constraints:

  • The experiment is running on a shared lab laptop, so I cannot make system-wide changes but, again, could switch to a separate conda environment if necessary.

Has anyone encountered a similar PyObjC version conflict before? I would be extremely grateful for any advice on how to resolve this.

Thank you in advance for your help!