Import Module error on an installed package 'pygame'

I am attempting to run the rpc_image_transfer_jpg_streaming_as_the_controller_device.py script to stream video from my H7 camera. I cannot run due to an error for “ImportError: no module named pygame”

Background: running this camera is the entirety of my Python experience.

I had installed pygame, so went to search for an answer to my issue on stack. Most comments there seemed to point to a mismatch between my multiple Python versions installed and pygame.

I have used “pip install pygame”, when that didn’t work I uninstalled it and tried a “pip3 install pygame”. I uninstalled that, then I tried downloading the binary and running “pip3 install pygame-2.5.2-cp312-cp312-win32.whl”. I tried installing at the directory level, the user level, and globally. I installed the 32 bit version and the 64 bit. I feel I am just creating a bigger mess.

If I type in ‘import pygame’ into the python terminal, there are no import issues. But continuously, when I try to run the aforementioned script from the OpenMV IDE, I always get the error.

Any ideas how to fix this pygame import module issue when running from the IDE?

Hi, that script is meant to run on the desktop PC.

The IDE is sending scripts to the camera to run. It’s not running Python on the PC.

To clarify, your PC runs python, and the OpenMV Cam runs python. OpenMV IDE sends Python scripts to the camera to run. It has nothing to do with desktop python on your PC.

The scripts in the tools/rpc directory in our github repo are for the desktop.

Thank you @kwagyeman.
I’m embarrassed by how far off I was, but for posterity’s sake, and because these forums have been very useful to me, I’ll write out my error:
I was trying to run the script that was meant to open my PC up for communication, through my OpenMV cam (rpc_image_transfer_jpg_streaming_as_the_controller_device.py). Updating my Python versions was obviously not affecting what Python was on my camera, so it could never run pygame.

As it says at the very top of that script, the script that should be running on the OpenMV is image_transfer_jpg_as_the_remote_device_for_your_computer.py, which completes the 2-way communication.