1

EDIT: I'm on MSYS2, that might be an important detail.

I'm trying to install the Pygame module. I tried both the command in the title and pip3 install pygame==2.0.0 It gives me the exact same error

 Downloading pygame-2.0.0.tar.gz (5.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.5/5.5 MB 5.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]


      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using UNIX configuration...

      /bin/sh: line 1: pkg-config: command not found
      /bin/sh: line 1: pkg-config: command not found
      /bin/sh: line 1: pkg-config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-vc2ohndm/pygame_606c8c39849546738a2efec90a6788f2/setup.py", line 318, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/tmp/pip-install-vc2ohndm/pygame_606c8c39849546738a2efec90a6788f2/buildconfig/config.py", line 221, in main
          deps = CFG.main(**kwds)
        File "/tmp/pip-install-vc2ohndm/pygame_606c8c39849546738a2efec90a6788f2/buildconfig/config_unix.py", line 222, in main
          DEPS.append(find_freetype())
        File "/tmp/pip-install-vc2ohndm/pygame_606c8c39849546738a2efec90a6788f2/buildconfig/config_unix.py", line 177, in find_freetype
          pkg_config = DependencyProg(
        File "/tmp/pip-install-vc2ohndm/pygame_606c8c39849546738a2efec90a6788f2/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
      IndexError: list index out of range

      Hunting dependencies...

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/Compilation
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [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.

I tried installing/upgrading setuptools, and pip. Still doesn't work.

Is there something I didn't do?

And after doing some things like downgrading pip, I get these errors.

    gcc.exe: warning: /W3: linker input file unused because linking not done
    gcc.exe: error: /W3: linker input file not found: No such file or directory
    gcc.exe: warning: /wd4142: linker input file unused because linking not done
    gcc.exe: error: /wd4142: linker input file not found: No such file or directory
    gcc.exe: warning: /wd4996: linker input file unused because linking not done
    gcc.exe: error: /wd4996: linker input file not found: No such file or directory
    error: command 'C:\\msys64\\mingw64\\bin/gcc.exe' failed with exit code 1

    ---
    For help with compilation see:
        https://www.pygame.org/wiki/CompileWindows
    To contribute to pygame development see:
        https://www.pygame.org/contribute.html
    ---

    ----------------------------------------
ERROR: Command errored out with exit status 1: C:/msys64/mingw64/bin/python.exe -u -c 'import io, os
, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:/Users/*mydir*/AppData/Local/Temp/pip-install-v85l6
05a/pygame_298d2ee7e2ce4c4abbe00a88f916be42/setup.py'"'"'; __file__='"'"'C:/Users/*mydir*/AppData/Loc
al/Temp/pip-install-v85l605a/pygame_298d2ee7e2ce4c4abbe00a88f916be42/setup.py'"'"';f = getattr(token
ize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptoo
ls import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(
compile(code, __file__, '"'"'exec'"'"'))' install --record C:/Users/*mydir*/AppData/Local/Temp/pip-re
cord-9j53j7hv/install-record.txt --single-version-externally-managed --compile --install-headers C:/
msys64/mingw64/include/python3.10/pygame Check the logs for full command output.
OK9090
  • 25
  • 5
  • 4
    Why _pygame==2.0.0_? The latest stable release version is 2.1.2 (see https://github.com/pygame/pygame/releases) – Rabbid76 Oct 27 '22 at 17:01
  • @Rabbid76 on the pygame website, I clicked the link to install pygame, which led me here https://github.com/pygame/pygame/releases/tag/2.0.0 – OK9090 Oct 27 '22 at 17:04
  • This means the major version 2.x.x, but not explicitly 2.0.0. – Rabbid76 Oct 27 '22 at 18:20
  • 1
    What version of Python do you have btw? Because even if `pip install pygame` fails (and you have Python 3.11) see this answer: https://stackoverflow.com/questions/74188013/python-pygame-not-installing – Matiiss Oct 27 '22 at 19:45
  • @Matiiss 3.10.8 – OK9090 Oct 28 '22 at 17:07
  • Alright, well, then just do `pip install pygame` – Matiiss Oct 28 '22 at 20:36
  • @Matiiss that gives an error too. – OK9090 Oct 30 '22 at 02:06
  • @OK9090 what error? if it's a very long error where pip says it's an issue with the package most likely you probably have python 3.11 in which case refer to my other answer and the linked question – Matiiss Oct 31 '22 at 08:29
  • @Matiiss I tried the 3.11 solution and got the error above. – OK9090 Oct 31 '22 at 16:06

1 Answers1

0

It looks like you don't have pkg-config installed:

/bin/sh: line 1: pkg-config: command not found

Alex Bender
  • 846
  • 13
  • 26