Skip to content

rt-midi python 3.13 #217

Open
Open

Description

@tieu-sys

Hello,
Is there a limitation to use rt-midi with python 3.13 ?

Activity

  1. PimDoos commented on Apr 15, 2025

    @PimDoos

    It looks like there are no prebuilt wheels for Python 3.13 on PyPI yet, so it will not work out of the box on Python 3.13. However, the library seems to work fine on Python 3.13 from my quick test.
    You can build it from source or install using this test wheel file artifact from this Github action.

  2. tieu-sys commented on Apr 16, 2025

    @tieu-sys
    Author

    Thanks, I tried the wheel and it works perfectly for my usage.
    Thanks !

    I hope it will be available soon on PyPI.
    Have a good day !

  3. SpotlightKid commented on Apr 16, 2025

    @SpotlightKid
    Owner

    I'll try to release a new version soon, which will have prebuilt wheels for Python 3.13. As @PimDoos discovered, the CI is already in place, I just need to find the time for the actual release process.

  4. ohcibi commented on Aug 14, 2025

    @ohcibi

    Building the package on macos with apple silicon fails.

    $ python3 -c "import platform; print(platform.python_version(), platform.machine(), platform.architecture())"
    3.13.6 arm64 ('64bit', 'Mach-O')
    

    This is the error:

     python -m pip install python-rtmidi
    Collecting python-rtmidi
      Using cached python_rtmidi-1.5.8.tar.gz (368 kB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... error
      error: subprocess-exited-with-error
    
      × Preparing metadata (pyproject.toml) did not run successfully.
      │ exit code: 1
      ╰─> [129 lines of output]
          + meson setup /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-install-4xoodvum/python-rtmidi_2f4f31fdc8c742688f7753bc5d08d866 /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-install-4xoodvum/python-rtmidi_2f4f31fdc8c742688f7753bc5d08d866/.mesonpy-k30fjgz8 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dwheel=true -Dverbose=false -Dbuildtype=plain --native-file=/private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-install-4xoodvum/python-rtmidi_2f4f31fdc8c742688f7753bc5d08d866/.mesonpy-k30fjgz8/meson-python-native-file.ini
          The Meson build system
          Version: 1.8.3
          Source dir: /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-install-4xoodvum/python-rtmidi_2f4f31fdc8c742688f7753bc5d08d866
          Build dir: /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-install-4xoodvum/python-rtmidi_2f4f31fdc8c742688f7753bc5d08d866/.mesonpy-k30fjgz8
          Build type: native build
          Project name: python-rtmidi
          Project version: 1.5.8
          C++ compiler for the host machine: c++ (clang 17.0.0 "Apple clang version 17.0.0 (clang-1700.0.13.5)")
          C++ linker for the host machine: c++ ld64 1167.5
          Host machine cpu family: aarch64
          Host machine cpu: aarch64
          Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.5.1
          Run-time dependency jack found: YES 1.9.22
          Dependency jack found: NO found 1.9.22 but need: '>=0.125.0', '<1.0' (cached)
          Run-time dependency appleframeworks found: YES (coreaudio, coremidi, foundation)
          Run-time dependency threads found: YES
          Has header "semaphore.h" : YES
          Program python3 found: YES (/Users/ohcibi/.pyenv/versions/3.13.6/bin/python)
          Program cython found: YES (/private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-build-env-2v1_bg35/overlay/bin/cython)
          Run-time dependency python found: YES 3.13
          Configuring version.py using configuration
          Build targets in project: 1
    
          python-rtmidi 1.5.8
    
            Configuration
              Host machine system     : darwin
              Python version          : 3.13
              Debug messages (verbose): false
              Build for wheel         : true
              JACK support            : true
              ALSA support            : false
              CoreMIDI support        : true
              Window MM support       : false
    
            User defined options
              Native files            : /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-install-4xoodvum/python-rtmidi_2f4f31fdc8c742688f7753bc5d08d866/.mesonpy-k30fjgz8/meson-python-native-file.ini
              b_ndebug                : if-release
              b_vscrt                 : md
              buildtype               : plain
              verbose                 : false
              wheel                   : true
    
          Found ninja-1.13.0.git.kitware.jobserver-pipe-1 at /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-build-env-2v1_bg35/overlay/bin/ninja
          + /private/var/folders/_p/hj3g0dlx2w18vxqddhwkt02c0000gn/T/pip-build-env-2v1_bg35/overlay/bin/ninja
          [1/3] Compiling C++ object rtmidi/_rtmidi.cpython-313-darwin.so.p/.._src__rtmidi.cpp.o
          ../src/_rtmidi.cpp:1294:59: warning: 'Py_UNICODE' is deprecated [-Wdeprecated-declarations]
           1294 | static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
                |                                                           ^
          /Users/ohcibi/.pyenv/versions/3.13.6/include/python3.13/cpython/unicodeobject.h:10:1: note: 'Py_UNICODE' has been explicitly marked deprecated here
             10 | Py_DEPRECATED(3.13) typedef wchar_t Py_UNICODE;
                | ^
          /Users/ohcibi/.pyenv/versions/3.13.6/include/python3.13/pyport.h:251:54: note: expanded from macro 'Py_DEPRECATED'
            251 | #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                |                                                      ^
          ../src/_rtmidi.cpp:1296:11: warning: 'Py_UNICODE' is deprecated [-Wdeprecated-declarations]
           1296 |     const Py_UNICODE *u_end = u;
                |           ^
          /Users/ohcibi/.pyenv/versions/3.13.6/include/python3.13/cpython/unicodeobject.h:10:1: note: 'Py_UNICODE' has been explicitly marked deprecated here
             10 | Py_DEPRECATED(3.13) typedef wchar_t Py_UNICODE;
                | ^
          /Users/ohcibi/.pyenv/versions/3.13.6/include/python3.13/pyport.h:251:54: note: expanded from macro 'Py_DEPRECATED'
            251 | #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                |                                                      ^
          ../src/_rtmidi.cpp:14858:1: warning: missing field 'tp_versions_used' initializer [-Wmissing-field-initializers]
           14858 | };
                 | ^
          ../src/_rtmidi.cpp:15039:1: warning: missing field 'tp_versions_used' initializer [-Wmissing-field-initializers]
           15039 | };
                 | ^
          ../src/_rtmidi.cpp:15193:1: warning: missing field 'tp_versions_used' initializer [-Wmissing-field-initializers]
           15193 | };
                 | ^
          ../src/_rtmidi.cpp:21572:1: warning: missing field 'tp_versions_used' initializer [-Wmissing-field-initializers]
           21572 | };
                 | ^
          6 warnings generated.
          [2/3] Compiling C++ object rtmidi/_rtmidi.cpython-313-darwin.so.p/.._src_rtmidi_RtMidi.cpp.o
          FAILED: [code=1] rtmidi/_rtmidi.cpython-313-darwin.so.p/.._src_rtmidi_RtMidi.cpp.o
          c++ -Irtmidi/_rtmidi.cpython-313-darwin.so.p -Irtmidi -I../rtmidi -Isrc -I../src -I../src/rtmidi -I/Users/ohcibi/.pyenv/versions/3.13.6/include/python3.13 -I/opt/homebrew/Cellar/jack/1.9.22_1/include -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -Wextra -std=c++11 -D__MACOSX_CORE__ -D__UNIX_JACK__ -DJACK_HAS_PORT_RENAME -DHAVE_SEMAPHORE -D__RTMIDI_SILENCE_WARNINGS__ -MD -MQ rtmidi/_rtmidi.cpython-313-darwin.so.p/.._src_rtmidi_RtMidi.cpp.o -MF rtmidi/_rtmidi.cpython-313-darwin.so.p/.._src_rtmidi_RtMidi.cpp.o.d -o rtmidi/_rtmidi.cpython-313-darwin.so.p/.._src_rtmidi_RtMidi.cpp.o -c ../src/rtmidi/RtMidi.cpp
          ../src/rtmidi/RtMidi.cpp:1554:15: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
           1554 |   Byte buffer[bufsize+16]; // pad for other struct members
                |               ^~~~~~~~~~
          ../src/rtmidi/RtMidi.cpp:1554:15: note: read of non-const variable 'bufsize' is not allowed in a constant expression
          ../src/rtmidi/RtMidi.cpp:1553:13: note: declared here
           1553 |   ByteCount bufsize = nBytes > 65535 ? 65535 : nBytes;
                |             ^
          ../src/rtmidi/RtMidi.cpp:3427:3: warning: 'sem_init' is deprecated [-Wdeprecated-declarations]
           3427 |   sem_init( &data->sem_cleanup, 0, 0 );
                |   ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:55:42: note: 'sem_init' has been explicitly marked deprecated here
             55 | int sem_init(sem_t *, int, unsigned int) __deprecated;
                |                                          ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:214:40: note: expanded from macro '__deprecated'
            214 | #define __deprecated    __attribute__((__deprecated__))
                |                                        ^
          ../src/rtmidi/RtMidi.cpp:3428:3: warning: 'sem_init' is deprecated [-Wdeprecated-declarations]
           3428 |   sem_init( &data->sem_needpost, 0, 0 );
                |   ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:55:42: note: 'sem_init' has been explicitly marked deprecated here
             55 | int sem_init(sem_t *, int, unsigned int) __deprecated;
                |                                          ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:214:40: note: expanded from macro '__deprecated'
            214 | #define __deprecated    __attribute__((__deprecated__))
                |                                        ^
          ../src/rtmidi/RtMidi.cpp:3468:3: warning: 'sem_destroy' is deprecated [-Wdeprecated-declarations]
           3468 |   sem_destroy( &data->sem_cleanup );
                |   ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:53:26: note: 'sem_destroy' has been explicitly marked deprecated here
             53 | int sem_destroy(sem_t *) __deprecated;
                |                          ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:214:40: note: expanded from macro '__deprecated'
            214 | #define __deprecated    __attribute__((__deprecated__))
                |                                        ^
          ../src/rtmidi/RtMidi.cpp:3469:3: warning: 'sem_destroy' is deprecated [-Wdeprecated-declarations]
           3469 |   sem_destroy( &data->sem_needpost );
                |   ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:53:26: note: 'sem_destroy' has been explicitly marked deprecated here
             53 | int sem_destroy(sem_t *) __deprecated;
                |                          ^
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:214:40: note: expanded from macro '__deprecated'
            214 | #define __deprecated    __attribute__((__deprecated__))
                |                                        ^
          ../src/rtmidi/RtMidi.cpp:3580:5: error: use of undeclared identifier 'sem_timedwait'
           3580 |     sem_timedwait( &data->sem_cleanup, &ts );
                |     ^
          5 warnings and 1 error generated.
          ninja: build stopped: subcommand failed.
          [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.
    
  5. SpotlightKid commented on Aug 18, 2025

    @SpotlightKid
    Owner

    Probably the Cython-generated C source needs to be re-generated.

    I still need to release a new version with official Python 3.13 support. I will try to do so towards the end of the month.

    In the meantime, you can try to build from the HEAD of the git repo, e.g. with:

     python -m pip install  git+https://github.com/SpotlightKid/python-rtmidi.git
    
  6. Maboroshy commented on Sep 19, 2025

    @Maboroshy

    Any updates on this? My project - MIDI Scripter depends on python-rtmidi and is currently uninstallable from pip for 3.13.

  7. Bubobubobubobubo commented on Oct 19, 2025

    @Bubobubobubobubo

    Hello. Any update on this? I am also trying to upgrade my application from Python 3.12 to Python 3.13.

  8. added a commit that references this issue on Jan 22, 2026
  9. josephine-wolf-oberholtzer commented on Feb 11, 2026

    @josephine-wolf-oberholtzer

    I was able to get past the OSX 3.13 use of undeclared identifier 'sem_timedwait' build failure with this patch:

    diff --git a/meson.build b/meson.build
    index f1efb3c..c5ad737 100644
    --- a/meson.build
    +++ b/meson.build
    @@ -72,7 +72,7 @@ coremidi_support = host_machine.system().to_lower() == 'darwin' and coremidi_dep
     winmm_support = host_machine.system().to_lower() == 'windows' and winmm_dep.found() and get_option('winmm')
    
     threads_dep = dependency('threads', required: alsa_support or jack_support)
    -have_semaphore = cpp.has_header('semaphore.h')
    +have_semaphore = host_machine.system().to_lower() != 'darwin' and cpp.has_header('semaphore.h')
    
     pymod = import('python')
     python = pymod.find_installation(get_option('python'), required: true, pure: false)
    

    Would still love a release! My work is stuck on Python 3.12.

  10. archth commented on Feb 14, 2026

    @archth

    My project Chordamap is stuck on Python 3.12 as well because of the dependency on this library. I would greatly appreciate a new release so I can update my project to the latest Python version.

  11. Karmak23 commented on Feb 17, 2026

    @Karmak23

    I'm trying to build fresh on Windows to code a new midi project, with latest python 3.14, following the RTD page, and it fails for another reason:

    (build env : VSC++ latest as of today, python 3.14 from installer, powershell up-to-date, PATH updated, python-rtmidi cloned from github repo)

    python -m pip build
    [...]
    Has header "semaphore.h" : YES                                                                                                         
    Program python3 found: YES (C:\Users\olive\AppData\Local\Temp\build-env-h8xm5__j\Scripts\python.exe)                                   
    Has header "Python.h" : YES
    ..\src\meson.build:3:17: ERROR: File rtmidi/RtMidi.cpp does not exist.
    
    A full log can be found at C:\Users\olive\AppData\Local\Temp\build-via-sdist-fd__60z3\python_rtmidi-1.6.0\.mesonpy-73o4b70x\meson-logs\meson-log.txt
    
    ERROR Backend subprocess exited when trying to invoke build_wheel
    

    Needless to say the "full log" is unavailable because the build env is auto-cleaned against my will before I can open it in explorer.

    I've cloned the rtmidi source code from github (version 6.0.0) in python-rtmidi/src/rtmidi/ which was empty, but it fails with exactly the same error. It seems it create a temp build env and doesn't pick the rtmidi source up. Where should I put it, or how to specify where the C++ code is for the build process to find it ?

    I see the thing seem to compile file on some linux hosts (eg. https://packages.msys2.org/packages/mingw-w64-x86_64-rtmidi). Do I really need to get a linux machine to be able to python+midi ?

  12. josephine-wolf-oberholtzer commented on Feb 17, 2026

    @josephine-wolf-oberholtzer

    @Karmak23 If you clone this repo recursively, the rtmidi submodule will get cloned too. It already includes the RtMidi.cpp file.

  13. Czaki commented on Apr 10, 2026

    @Czaki

    @SpotlightKid Any chance on a next release?

  14. josephine-wolf-oberholtzer commented on Apr 19, 2026

    @josephine-wolf-oberholtzer

    While we wait for a new PyPI release here, I cut my own nanobind-based binding for RtMidi and published wheels for Linux/OSX/Windows Python 3.10 through 3.14: https://github.com/supriya-project/supriya-midi. I tried to keep the interface very similar to this library's API.

  15. tieu-sys commented on May 18, 2026

    @tieu-sys
    Author

    I did a pull request here to provide the 3.13 whee (#226)
    Before pypi release, you can try the wheel with these artefacts: (https://github.com/tieu-sys/python-rtmidi/actions/runs/25916616387#artifacts)

  16. cpmpercussion commented on Sep 26, 2026

    @cpmpercussion

    Hi @SpotlightKid, thanks for all your work on python-rtmidi. I maintain IMPSY, a Python system for AI musical instruments that uses python-rtmidi through mido. At the moment IMPSY users on Python 3.13 need a compiler (and ALSA headers on a Raspberry Pi) to install it, and I'm looking at moving to 3.14 soon.

    I noticed that master already has the 1.6.0 changes and working wheel builds, but the cibuildwheel setup stops at 3.13. I've made a small PR that adds 3.14 wheels and updates cibuildwheel (#229). The wheel builds and tests pass on my fork for Linux, macOS and Windows.

    If it helps, I'm happy to test a release candidate or help with anything else that would get 1.6.0 out. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions