1

I am trying to install PyGame on PyCharm.

History: clicked on File -> New projects setup -> settings for new project -> selected python -> click on "+" -> searched "pygame" on search bar -> install package -> ERROR

but I am getting this error:

Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

  error: subprocess-exited-with-error
  
  python setup.py egg_info did not run successfully.
  exit code: 1
  
  [77 lines of output]
  
  
  WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
  Using WINDOWS configuration...
  
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\Lorak\AppData\Local\Temp\pip-install-cfn9p2mm\pygame_5ad100b5f0cd46c68e6fee4d61f31110\setup.py", line 359, in <module>
      buildconfig.config.main(AUTO_CONFIG)
    File "C:\Users\Lorak\AppData\Local\Temp\pip-install-cfn9p2mm\pygame_5ad100b5f0cd46c68e6fee4d61f31110\buildconfig\config.py", line 225, in main
      deps = CFG.main(**kwds)
             ^^^^^^^^^^^^^^^^
    File "C:\Users\Lorak\AppData\Local\Temp\pip-install-cfn9p2mm\pygame_5ad100b5f0cd46c68e6fee4d61f31110\buildconfig\config_win.py", line 511, in main
      return setup_prebuilt_sdl2(prebuilt_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(...)
    File "C:\Users\Lorak\PycharmProjects\gameproject\venv\Lib\site-packages\setuptools\_distutils\msvc9compiler.py", line 403, in initialize
      vc_env = query_vcvarsall(VERSION, plat_spec)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(...)
 
  ---
  
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: python.exe -m pip install --upgrade pip`



I don't know how to fit it :(

I tried to install other versions, but there is no difference. Still getting error.

I also tried do it via terminal, but when I use "pip install pygame" another error jumps telling me that "pip is not recognized". I don't know if this is same or other error. I tried to find info on the internet but there is nothing even similar to this error. I have also tried to update pip via manual and it worked, but I am still getting the same error.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Lorak
  • 33
  • 6
  • You're running a Python version for which there is no pre-built Python wheel, and you're not able to build it from source on your machine. Guessing you're on Python 3.11, see https://github.com/pygame/pygame/issues/3522 – AKX Feb 09 '23 at 16:29
  • Did you edit the errors out of the error message yourself, or are they being hidden by your terminal application? In either case, please fill in the `(...)`s – Brian61354270 Feb 09 '23 at 16:29
  • I cannot fill the (...) because StackOverflow for some reason mark it as spam :( but I have the full code con GitHub: https://github.com/pygame/pygame/issues/3704 – Lorak Feb 09 '23 at 17:18
  • So if there is no pre-built for 3.11, maybe the solution is to use and older version of python? – Lorak Feb 09 '23 at 17:21
  • Ignore last comment, I cannot edit it already: So if there is no pre-built for 3.11, will it ever be? By the way, thanks because the other forum you recommend I have used the `pip install pygame --pre` command and it worked. Actually I am a noob just learning Python and programming skills and I don't really know what I have done. But it looks like it worked. The termonal "told" me that pygame is installed and no error poped. Thanks a lot! I've been since yesterday going crazy to fix this! – Lorak Feb 09 '23 at 17:28

0 Answers0