No module named pygame
Pygame is installed, but into a different Python.
Step-by-step fixes for the problems people hit most often, from installation errors to frozen windows, black screens and missing sound.
Pygame is installed, but into a different Python.
A checklist for installs that fail or never start.
Build failures, compiler errors and managed environments.
Frozen windows, "Not Responding" and windows that won't close.
Silent games, mixer errors, delays and crackling.
The window opens but nothing appears.
Which Python versions have Pygame wheels and what to do otherwise.
| What you see | Read |
|---|---|
| pip fails, or installs nothing | Pygame won't install |
Long build errors, sdl2-config, Visual C++, externally-managed-environment | pip install errors |
ModuleNotFoundError: No module named 'pygame' | No module named pygame |
| New Python version won't install Pygame | Python compatibility |
| Window freezes, says "Not Responding" or won't close | Window not responding |
| Window opens but stays black | Black screen |
Silence, mixer not initialized, delayed sound | No sound |
Collect this information; it answers most questions straight away:
python --version
python -c "import pygame, sys; print(pygame.version.ver, sys.platform, sys.executable)"Include the full error message (copy the text, not a screenshot), what you expected, and a small piece of code that reproduces the problem. Bugs in Pygame itself can be reported to the pygame or pygame-ce issue trackers.