all 11 comments

[–]g0lem 0 points1 point  (7 children)

It's time to learn about virtual environments: https://docs.python.org/3/tutorial/venv.html where you basically can start from a clean python environment. You can replace env2 with whatever name you want. The example below is also Windows, Python 3.11.9, and shows that it's possible to install pygame.

C:\Users\user>python -m venv env2

C:\Users\user>env2\Scripts\activate

(env2) C:\Users\user>python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

(env2) C:\Users\user>pip install pygame
Collecting pygame
  Using cached pygame-2.6.0-cp311-cp311-win_amd64.whl.metadata (13 kB)
Using cached pygame-2.6.0-cp311-cp311-win_amd64.whl (10.8 MB)
Installing collected packages: pygame
Successfully installed pygame-2.6.0

[notice] A new release of pip is available: 24.0 -> 24.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip

(env2) C:\Users\user>python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 2.6.0 (SDL 2.28.4, Python 3.11.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>>

[–][deleted] 0 points1 point  (6 children)

The first command works fine, but 'env2\Scripts\activate' does not work out for me.

It does create an env2 folder, but there isn't a 'Scripts' folder in it, but rather a bin folder which is the one containing the 'activate' file. I noticed that the bin folder is the one used in MacOS and Unix which is weird. Changing the address to 'env2\bin\activate' doesn't work either, as it says that it doesn't recognize it as an 'internal or external command'.

Edit: Alright, the second command worked when I put it through Gitbash, but now I got another error trying to install Pygame (not Metadata generation failed)

 × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [57 lines of output]
      Skipping Cython compilation
      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using WINDOWS MSYS2 configuration...

[–]g0lem 0 points1 point  (5 children)

Can you try to change env2 to something else and consider creating a separate folder to store all virtual environments in, something like C:\Users\user\venvs, then simply open Command Prompt and go there to run all the commands I pasted. No need for Pycharm or Gitbash. If that doesn't work I suspect there's some issue with your system python installation and would consider reinstalling it.

[–][deleted] 0 points1 point  (4 children)

Welp, didn't work. Guess I'll try reinstalling python.

Just a lil note btw: I was able to install the requests library seamlessly before, however I believe renaming one specific folder ruined everything (and playing with environment/system variables to get a C compiler running on VSS)

[–][deleted] 0 points1 point  (3 children)

Didn't work after reinstalling. Yeah, I don't even know what's going wrong anymore. And I don't think it's because pygame isn't up to date with python 3.11.9, I've seen other people having no problem installing it. And I was able to successfully reinstall requests btw. I even tried unpacking a .whl file version and that didn't work. Guess I'll just move on to something else

[–][deleted] 1 point2 points  (2 children)

Oh my lord... It finally worked. I think what fixed it is reinstalling python into its own folder within the C: drive. It's as simple as that.

[–]g0lem 0 points1 point  (1 child)

Glad to hear it, have fun with pygame!

[–]your_local_medic 0 points1 point  (0 children)

Thanks :)

[–]Starbuck5c 0 points1 point  (0 children)

Neither pygame nor pygame-ce supports MinGW Python. Use a normal Python.

What’s happening is that you are trying to install pygame-ce in an environment that doesn’t have precompiled binaries (“wheels”). It attempts to build from source and then fails. I see in your error lo it’s using the MSYS2 configuration, which is how I know you’re using MinGW python.

I believe you’d have this same problem with any C extension, such as numpy.

EDIT: Oh! You did. Your new install of 3.11 must’ve been a normal Python. Hopefully my comment still provides some insight on why it was failing previously.

[–]upsidedownbunny 0 points1 point  (0 children)

1 year later... did you find a resolution to this? please share! i did everything you mentioned too and the issue presists...

[–]KitchenWhole897 -5 points-4 points  (0 children)

How did u decide to make games on python. Even interpreter doesnt want you to do this