How to use Pupil Lab realtime API in psychopy

Hello everyone. I am using standalone psychopy software to build a visual stimulation program. Also, I would like to use the pupil lab realtime api to control the eyetracker.

However, I am having a problem importing the api. After I run the following code.


import nest_asyncio
nest_asyncio.apply()

from pupil_labs.realtime_api.simple import discover_one_device
device = discover_one_device()

print(f"Phone IP address: {device.phone_ip}“)
print(f"Phone name: {device.phone_name}”)
print(f"Battery level: {device.battery_level_percent}%“)
print(f"Free storage: {device.memory_num_free_bytes / 1024**3:.1f} GB”)
print(f"Serial number of connected glasses: {device.serial_number_glasses}")


I got this error → ModuleNotFoundError: No module named ‘av._core’

I can successfully run the problematic importing sentence in my terminal, and I also added the path to my site package folder to psychopy.
Screen Shot 2022-11-04 at 10.55.52

After searching for a solution, one possible reason is that executing the ‘import av’ sentence inside the av folder may cause such an error. But I write the code in the code component of psychopy and I don’t know if this is the cause.

I also tried the beta version of the eyetracker component provided by psychopy, however, I am using pupillab invisible and it seems that the eyetracker component only works for pupillab core.

Can anyone give me some ideas about how to solve this problem.

There is some information to help you.
MacBook Pro (16-inch, 2021)
macOS Monterey Version 12.6
Standalone Psychopy v2022.2.2