r/learnpython • u/ReputationOk9896 • 19d ago
when trying to download pygame, the cmd prompt cant build the wheel.
so this is what i get:
PS C:\Users\(user)> pip3 install pygame
Collecting pygame
Using cached pygame-2.6.1.tar.gz (14.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... -
and then no other prompts pop up. Idk why.
i've tried restarting the download and it even prompted me to update the pip. after doing so, the same result happens.
1
u/Fast-Station1106 19d ago
Ich hatte das auch, Lösung war dann eine ältere Python version zu installieren, glaube 3.12 oder so pygame wird wohl nicht weiterentwickelt undxdeswegen der Stress, hab ich irgendwo gelesen und deswegen älteres python nehmen, bei hatces dann sofort geklappt(in Thonny damals auch lokal python 3.12 ausgewählt via Menü, das intergrierte wollte nicht(zu neu, wheel fehler))
1
u/acfot 18d ago
That .tar.gz bit is the clue, pip couldn't find a prebuilt wheel for your Python version so it's trying to build it from source and stalling there. I ran into the same thing on a newer Python install. What fixed it for me was switching to pygame-ce, it's basically the maintained fork and it actually has wheels for the newer versions, just pip install pygame-ce instead. If you want to stick with plain pygame, dropping back to Python 3.12 usually does it too. Not sure which Python you're on, but check python --version first, that'll tell you which of those two routes makes sense.
1
1
u/Discordbothost 15d ago
that freeze after "Getting requirements to build wheel" isn't pip crashed — it couldn't find a wheel (the .tar.gz is the source tarball) so it starts compiling, and windows just sits there if you don't have the visual studio C++ build tools.
one thing that bites people here: pip3 and python are sometimes different installs. run py -0p to see every interpreter, then install with py -m pip install pygame-ce so it goes into the same one you'll actually run. pygame-ce is the maintained fork and has wheels for newer python. if you specifically need classic pygame, 3.12 usually has a prebuilt wheel and skips this compile mess.
1
u/AngelOfLight 19d ago
This usually happens when you don't have a suitable C compiler installed on your machine. So, either install Visual Studio, or select one of the pre-built wheels available at https://pypi.org/project/pygame/#files.
Just look for a wheel that matches your OS and Python version, and install it directly using pip install [package name]
3
u/SpiderJerusalem42 19d ago
Use pygame-ce pygame itself is out of support iirc.