1

I had pygame (not ce) on my Debian system and then updated it to pygame-ce using pip install —-upgrade pygame-ce and it worked fine, installing pygame-ce==2.5.2 . There were some more recent updates since and I decided to update pygame-ce again using the same command. I am using python 3.9.2 and pip 25.1.1 . I got a similar error trying to install it on windows but never this issue on my Linux box. It looks like there is no library portmidi which it apparently needs, but I tried running sudo apt install portmidi portmidi-dev but apparently neither of those packages exist. I don’t know where pip and/or meson is building pygame.

Full pip output:

$ pip install --upgrade pygame-ce
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pygame-ce in /usr/local/lib/python3.9/dist-packages (2.5.2)
Collecting pygame-ce
  Using cached pygame_ce-2.5.5.tar.gz (5.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      + meson setup /tmp/pip-install-7cxt5bz1/pygame-ce_1fb067b21b694b7e8cf6cc8e4fdaa8b1 /tmp/pip-install-7cxt5bz1/pygame-ce_1fb067b21b694b7e8cf6cc8e4fdaa8b1/.mesonpy-qmbs8ea0 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-7cxt5bz1/pygame-ce_1fb067b21b694b7e8cf6cc8e4fdaa8b1/.mesonpy-qmbs8ea0/meson-python-native-file.ini
      The Meson build system
      Version: 1.7.0
      Source dir: /tmp/pip-install-7cxt5bz1/pygame-ce_1fb067b21b694b7e8cf6cc8e4fdaa8b1
      Build dir: /tmp/pip-install-7cxt5bz1/pygame-ce_1fb067b21b694b7e8cf6cc8e4fdaa8b1/.mesonpy-qmbs8ea0
      Build type: native build
      Program python found: YES
      ../meson_options.txt:27: WARNING: Project does not target a minimum version but uses feature deprecated since '1.1.0': "boolean option" keyword argument "value" of type str. use a boolean, not a string
      ../meson_options.txt:31: WARNING: Project does not target a minimum version but uses feature deprecated since '1.1.0': "boolean option" keyword argument "value" of type str. use a boolean, not a string
      ../meson_options.txt:35: WARNING: Project does not target a minimum version but uses feature deprecated since '1.1.0': "boolean option" keyword argument "value" of type str. use a boolean, not a string
      Project name: pygame_ce
      Project version: 2.5.5
      C compiler for the host machine: cc (gcc 10.2.1 "cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
      C linker for the host machine: cc ld.bfd 2.35.2
      Cython compiler for the host machine: cython (cython 3.0.11)
      Host machine cpu family: arm
      Host machine cpu: arm
      Program python found: YES
      Program python found: YES (/usr/bin/python3)
      Found pkg-config: YES (/usr/bin/pkg-config) 0.29.2
      Run-time dependency python found: YES 3.9
      Has header "Python.h" with dependency python-3.9: YES
      Run-time dependency sdl2 found: YES 2.0.14
      Run-time dependency sdl2_image found: YES 2.0.5
      Run-time dependency sdl2_mixer found: YES 2.0.4
      Run-time dependency sdl2_ttf found: YES 2.0.15
      Run-time dependency freetype2 found: YES 23.4.17
      Found CMake: /usr/bin/cmake (3.18.4)
      WARNING: CMake Toolchain: Failed to determine CMake compilers state
      Run-time dependency portmidi found: NO (tried pkgconfig and cmake)
     
      ../meson.build:302:25: ERROR: C shared or static library 'portmidi' not found
     
      A full log can be found at /tmp/pip-install-7cxt5bz1/pygame-ce_1fb067b21b694b7e8cf6cc8e4fdaa8b1/.mesonpy-qmbs8ea0/meson-logs/meson-log.txt
      [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.

There appears not to be any file at /tmp/pip-install-7cxt5bz1/.../meson-logs/meson-log.txt .

2
  • 2
    This is the cause of the problem: "Run-time dependency portmidi found: NO". Install portmidi. Perhaps sudo apt install -y libportmidi-dev. Commented Jun 22 at 10:02
  • 3
    next time use apt search portmidi to check if there is portmidi and what is full name. On Linux Mint I see libportmidi-dev (probably source code) and libportmidi0 (compiled version) but you may have little different name Commented Jun 22 at 13:28

1 Answer 1

2

The issue is caused by the missing portmidi library, as indicated by the error message:

Run-time dependency portmidi found: NO (tried pkgconfig and cmake)
../meson.build:302:25: ERROR: C shared or static library 'portmidi' not found

On Debian-based systems (I saw Raspbian in the pip output, so you must be using a Debian system), the correct package to install is libportmidi-dev.

Here is the command to install it:

sudo apt install libportmidi-dev 

This package should help you to correctly build pygame-ce.

Also, if you're using a virtual environment for your project, ensure the development packages are installed for the same Python version you're using.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.