Can't use pygame midi on linux, python3

Issue #327 closed
naught101 created an issue

Using python 3 with pygame from pypi.

In [1]: from pygame import midi

In [2]: midi.init()
ALSA lib conf.c:3009:(snd_config_update_r) Cannot access file /etc/alsa/alsa.conf
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default

In [3]: midi.get_count()
Out[4]: 0

I'm not really sure why this is happening. Init works fine in python 2. Any suggestions? I'm happy to provide debugging info if you can tell me where to look.

Comments (7)

  1. Thomas Kluyver
    • changed version to 1.9.3

    Thanks, I made a 1.9.3 version in the issue tracker.

    Can you easily compile from source and test? It's possible that it's just a packaging artifact.

    It looks like pygame.midi calls into a file that's compiled from Cython (pypm.pyx -> pypm.c), and the conversion was last done in 2011. So the next thing I'd try would be to reconvert that with a more recent version of Cython.

  2. naught101 reporter

    Looks like you're right, installing from (bitbucket master) source works fine. Maybe the pypi package needs updating?

  3. Thomas Kluyver

    There are no changes in master since 1.9.3. I'd guess this is to do with how the packages are built. In order to work across different Linux distros, they're built on the manylinux docker image, which is based on an old version of Centos, and then the auditwheel tool bundles required libraries into the wheel.

    It's weird that it works on Python 2. Is your Python 2 installation using the same version of pygame installed the same way (from a wheel on PyPI)?

  4. Thomas Kluyver

    In pull request #77, I build a newer version of ALSA into the base image, so it gets bundled into the Linux wheels. When I test with this, I don't see the warning messages and midi.get_count() returns 2. So I think that's the fix.

  5. Log in to comment