Home > Software engineering >  How should I fix the "Sorry, extended image module required" error with Pygame?
How should I fix the "Sorry, extended image module required" error with Pygame?

Time:05-06

I am trying to use pygame with a Raspberry Pi, and no matter what installation I do, I always get this error:

user@raspberrypi:~ $ python3 -m pygame.examples.aliens
pygame 2.1.2 (SDL 2.0.9, Python 3.7.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
Sorry, extended image module required

I have tried python3 -m pip install -U pygame --user, which is suggested by the pygame website, and when I call python3 -m pygame.examples.aliens, the above error is produced. I have tried this both through JuiceSSH and on the Pi itself, to no avail.

Any help or suggestions would be greatly appreciated!

CodePudding user response:

You have not mentioned the OS your RPi is running. Raspbian has pygame already installed on default if you are running raspbian have you tried an older version? If its another flavour OS try manually installing each dependancy (ARM) pygame needs and then install pygame. Also try installing an older pygame version "pip install pygame==VERSION"

Best regards.

CodePudding user response:

See https://github.com/pygame/pygame/issues/3161 for the same issue.

Apparently, on raspberry pi pip does not download from the python package index (PyPi), it downloads from PiWheels.

PiWheels wheels do not seem to come with pygame's dependencies, that are bundled in normal releases.

The PiWheels site says to install pygame you need to run sudo apt install libvorbisenc2 libwayland-server0 libxi6 libfluidsynth2 libgbm1 libxkbcommon0 libopus0 libwayland-cursor0 libsndfile1 libwayland-client0 libportmidi0 libvorbis0a libopusfile0 libmpg123-0 libflac8 libxcursor1 libxinerama1 libasyncns0 libxrandr2 libdrm2 libpulse0 libxfixes3 libvorbisfile3 libmodplug1 libxrender1 libsdl2-2.0-0 libxxf86vm1 libwayland-egl1 libsdl2-ttf-2.0-0 libsdl2-image-2.0-0 libjack0 libsdl2-mixer-2.0-0 libinstpatch-1.0-2 libxss1 libogg0 as well as pip install pygame.

See https://www.piwheels.org/project/pygame/

  • Related