pygame / pygame

🐍🎮 pygame (the library) is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.
https://www.pygame.org
7.32k stars 3.25k forks source link

No module named 'pygame.pypm' when initializing midi (2.0.0-dev10) #1931

Closed sakuya9t closed 3 years ago

sakuya9t commented 4 years ago

Hello, I recent got this error on my Mac when I try to use the midi module.

Steps to reproduce:

  1. pip3 install pip3 install pygame==2.0.0-dev10
  2. open python console
  3. do following code block:
    import pygame
    import pygame.midi
    pygame.init()
    pygame.midi.init()
  4. get following error message:
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python3.7/site-packages/pygame/midi.py", line 79, in init
    import pygame.pypm
    ModuleNotFoundError: No module named 'pygame.pypm'
sakuya9t commented 4 years ago
  1. This issue doesn't exist on windows 2.0.0-dev10
  2. This issue doesn't exist on mac 1.9.6
illume commented 4 years ago

Thanks for the report.

This is related to the new build system(conan) being used on mac. There was no portmidi package I could find at the time, and forgot about it before the release. This is the conan issue: https://github.com/pygame/pygame/issues/997

michamusic commented 4 years ago

is there a solution?

illume commented 3 years ago

The solution is for someone to package portmidi as a 'conan' package. Unfortunately there isn't one still.

Another option is to compile pygame from source with homebrew on mac.

brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf portmidi
git clone https://github.com/pygame/pygame.git
cd pygame
python setup.py -config -auto -sdl2
python setup.py install
illume commented 3 years ago

This is fixed in #2187 and will be part of the next dev release.

illume commented 3 years ago

Hopefully pygame==2.0.0.dev20 fixes this properly.

NotVeryGoodAtCodingButOk commented 3 years ago

I am still getting this issue on mac with pygame version 2.0.2.dev1

Is there anything else that I can try to get this fixed?

Gabriel-522277 commented 2 years ago

The same problem for me, but my computer is a Win 10 -PC. The error message is: import pygame.pypm as pypm ImportError: DLL load failed while importing pypm: Le module spécifié est introuvable.

MIDI.py exists in my site-packages\pygame directory, but no PYPM.py at that location. Is there a solution for me ? Is it possible to download this file ? Thanks a lot for your help !

Gabriel-522277 commented 2 years ago

Since my previous comment, I found pypm.cp38-win32.pyd in this directory: Lib > site-packages > pygame Can that file repair my problem ? Thanks for your help.

illume commented 2 years ago

@Gabriel-522277 What version of pygame/python are you using? I assume you've tried uninstalling pygame, and installing the latest pygame?

It's usually better to open a new issue so people will notice it and be able to help.

Gabriel-522277 commented 2 years ago

Hi René, Thank you for your answer ! Your surname let me think that you could speak French. If it is the case, the next time, it will be easier for me to speak french 😊 ! Anyway, I dont use Pygame a long time age (perhaps 1 month ?). Now, I’m using pygame 2.0.1 (SDL 2.0.12, Python 3.8.1). I had no idea of what to do. According to you, which Pygame version should I install with Python 3.8.1 ?

And what to do to uninstall Pygame 2.0.1 ?

It’s very nice of you to help me, especially on a Sunday ! Thanks a lot.

Gabriel

De : René Dudfield Envoyé le :dimanche 6 février 2022 14:52 À : pygame/pygame Cc : Gabriel-522277; Mention Objet :Re: [pygame/pygame] No module named 'pygame.pypm' when initializingmidi (2.0.0-dev10) (#1931)

@Gabriel-522277 What version of pygame/python are you using? I assume you've tried uninstalling pygame, and installing the latest pygame? — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>

Gabriel-522277 commented 2 years ago

Your advice was successful ! I uninstalled pygame, and then installed. With Pygame version 2.1.2, pygame.midi is now accepted. Thanks a lot !

ei14 commented 1 year ago

Issue still occurs in pygame 2.1.3 (SDL 2.26.5, Python 3.11.3).

Edit: The issue is resolved by installing pygame 2.4.0 via pip. Is 2.4.0 an unstable preview or something? I ask because I don't see it listed in any common Linux package repos.