Quantcast
Viewing all articles
Browse latest Browse all 1234

Python • Pygame.mixer missing - thought I installed all dependencies (incl libsdl2.0-mixer-{2.0-0,dev}

Hi all:

I'm trying to run pygame on an RPi 3B+, getting the ModuleNotFound Error. I've looked at all the stack overflow and RPi forum posts I can find, none of them help.

ISSUE

Code:

  File "/home/pi/.local/lib/python3.12/site-packages/pygame/__init__.py", line 70, in __getattr__    raise NotImplementedError(missing_msg)NotImplementedError: mixer module not available (ModuleNotFoundError: No module named 'pygame.mixer')
STEPS TO REPRO / CODE SAMPLE
I can reproduce it by running:

Code:

$ python3Python 3.12.8 (main, Mar  6 2025, 18:09:00) [GCC 8.3.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import pygame<frozen importlib._bootstrap>:488: RuntimeWarning: Your system is neon capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.pygame 2.6.0 (SDL 2.0.9, Python 3.12.8)Hello from the pygame community. https://www.pygame.org/contribute.html>>> import pygame.mixerTraceback (most recent call last):  File "<stdin>", line 1, in <module>ModuleNotFoundError: No module named 'pygame.mixer'
THINGS I'VE TRIED
Most of the SO and forum posts seem to talk about installing libsdl2-mixer-2.0-0, but I've got that installed:

Code:

$ dpkg -l | grep sdlii  libsdl2-2.0-0:armhf                  2.0.9+dfsg1-1+rpt1                       armhf        Simple DirectMedia Layerii  libsdl2-dev                          2.0.9+dfsg1-1+rpt1                       armhf        Simple DirectMedia Layer development filesii  libsdl2-image-2.0-0:armhf            2.0.4+dfsg1-1+deb10u1                    armhf        Image loading library for Simple DirectMedia Layer 2, librariesii  libsdl2-mixer-2.0-0:armhf            2.0.4+dfsg1-1                            armhf        Mixer library for Simple DirectMedia Layer 2, librariesii  libsdl2-mixer-dev:armhf              2.0.4+dfsg1-1                            armhf        Mixer library for Simple DirectMedia Layer 2, development filesii  libsdl2-ttf-2.0-0:armhf              2.0.15+dfsg1-1                           armhf        TrueType Font library for Simple DirectMedia Layer 2, librariesii  libsdl2-ttf-dev:armhf                2.0.15+dfsg1-1                           armhf        TrueType Font library for Simple DirectMedia Layer 2, development files
I installed python 3.12.8 via:

Code:

#!/bin/bashpython_version=3.12.8wget https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tar.xztar xvf Python-${python_version}.tar.xz"cd Python-${python_version} &&  ./configure --enable-optimizations && \  make -j 4 && \  sudo make altinstall &&  sudo cp ./python /usr/local/bin/python${python_version} \  cd"sudo ln -sf /usr/local/bin/python${python_version} /usr/local/bin/python3sudo ln -sf /usr/local/bin/python${python_version} /usr/local/bin/python
I installed pygame 2.6 via:

Code:

#!/bin/bashpygame_version=2.6.0pip install --upgrade pippython3 -m pip install -U pygame==${pygame_version} --user
In case it matters - I run a script on a development machine to install dependencies on the rPi - so all the commands are happening inside

Code:

ssh pi@<address> -- 
. It shouldn't matter, but mentioning it just in case.

Unfortunately, at this point I'm afraid that I've done so much manual installing/uninstalling using a combination of systems (pip, python3 -m pip, apt, apt-get) that I might have something installed that needs to be uninstalled.

I've been at this for many hours, looked all over the internet, even filed a github issue with pygame. I'd really appreciate any help!!

Statistics: Posted by GameMaker — Mon Mar 10, 2025 1:51 am



Viewing all articles
Browse latest Browse all 1234

Trending Articles