Python rtmidi install error

I am getting the following error in Ubuntu 17.04 when trying to install python-rtmidi from pip: shyamal@shyamal-Inspiron-7548:~$ pip install --user python-rtmidi Collecting python-rtmidi Using cach...

I am getting the following error in Ubuntu 17.04 when trying to install python-rtmidi from pip:

shyamal@shyamal-Inspiron-7548:~$ pip install --user python-rtmidi
Collecting python-rtmidi
  Using cached python-rtmidi-1.1.0.zip
Building wheels for collected packages: python-rtmidi
  Running setup.py bdist_wheel for python-rtmidi ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xCv92E/python-rtmidi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpe04Ofbpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/rtmidi
  copying rtmidi/midiutil.py -> build/lib.linux-x86_64-2.7/rtmidi
  copying rtmidi/__init__.py -> build/lib.linux-x86_64-2.7/rtmidi
  copying rtmidi/midiconstants.py -> build/lib.linux-x86_64-2.7/rtmidi
  copying rtmidi/release.py -> build/lib.linux-x86_64-2.7/rtmidi
  running build_ext
  building 'rtmidi._rtmidi' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc -I/usr/include/python2.7 -c src/_rtmidi.cpp -o build/temp.linux-x86_64-2.7/src/_rtmidi.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  src/_rtmidi.cpp: In function ‘void init_rtmidi()’:
  src/_rtmidi.cpp:6955:32: warning: self-comparison always evaluates to true [-Wtautological-compare]
     __pyx_t_2 = ((&PyBytes_Type) == (&PyString_Type));
                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc -I/usr/include/python2.7 -c src/RtMidi.cpp -o build/temp.linux-x86_64-2.7/src/RtMidi.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  src/RtMidi.cpp:2448:23: fatal error: jack/jack.h: No such file or directory
   #include <jack/jack.h>
                         ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for python-rtmidi
  Running setup.py clean for python-rtmidi
Failed to build python-rtmidi
Installing collected packages: python-rtmidi
  Running setup.py install for python-rtmidi ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xCv92E/python-rtmidi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-8NJ8ff-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/rtmidi
    copying rtmidi/midiutil.py -> build/lib.linux-x86_64-2.7/rtmidi
    copying rtmidi/__init__.py -> build/lib.linux-x86_64-2.7/rtmidi
    copying rtmidi/midiconstants.py -> build/lib.linux-x86_64-2.7/rtmidi
    copying rtmidi/release.py -> build/lib.linux-x86_64-2.7/rtmidi
    running build_ext
    building 'rtmidi._rtmidi' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc -I/usr/include/python2.7 -c src/_rtmidi.cpp -o build/temp.linux-x86_64-2.7/src/_rtmidi.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    src/_rtmidi.cpp: In function ‘void init_rtmidi()’:
    src/_rtmidi.cpp:6955:32: warning: self-comparison always evaluates to true [-Wtautological-compare]
       __pyx_t_2 = ((&PyBytes_Type) == (&PyString_Type));
                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc -I/usr/include/python2.7 -c src/RtMidi.cpp -o build/temp.linux-x86_64-2.7/src/RtMidi.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    src/RtMidi.cpp:2448:23: fatal error: jack/jack.h: No such file or directory
     #include <jack/jack.h>
                           ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xCv92E/python-rtmidi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-8NJ8ff-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-xCv92E/python-rtmidi/

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

python-rtmidi uses the de-facto standard Python distutils and setuptools
based packaging system and can be installed from the Python Package Index via
pip. Since it is a Python C(++)-extension, a C++ compiler and build
environment as well as some system-dependent libraries are needed to install,
unless wheel packages with pre-compiled binaries are available for your system.
See the Requirements section below for details.

From PyPI¶

If you have all the requirements, you should be able to install the package
with pip:

$ pip install python-rtmidi

This will download the source distribution from python-rtmidi’s PyPI page,
compile the extension (if no pre-compiled binary wheel is available) and
install it in your active Python installation. Unless you want to change the
Cython source file _rtmidi.pyx, there is no need to have Cython installed.

Note

On some Linux distributions, e.g. Debian, which support both Python 2 and
Python 3, pip may installed under the name pip2 resp. pip3. In this
case, just pip2 instead of pip if you’re still using Python 2 (not
officially supported), or pip3 if you are using Python 3.

python-rtmidi also works well with virtualenv and virtualenvwrapper. If you
have both installed, creating an isolated environment for testing and/or using
python-rtmidi is as easy as:

$ mkvirtualenv rtmidi
(rtmidi)$ pip install python-rtmidi

If you want to pass options to the build process, use pip’s install-option
option. See the From Source section below for available options.

Pre-compiled Binaries¶

Pre-compiled binary wheels of the latest python-rtmidi version for Windows and
macOS / OS X are available on PyPI for several major Python versions. If you
install python-rtmidi via pip (see above), these wheels will be selected by pip
automatically, if you have a compatible Python and Windows or macOS version.

The Windows binary wheels are compiled with Windows MultiMedia API support and
are available in 32-bit and 64-bit versions. The macOS / OS X binary wheels are
compiled with CoreMIDI support and are only available in 64-bit versions for
OS X 10.6 and later. If you need JACK support on OS X, you need to compile
python-rtmidi yourself (see the macOS section below for details).

From Source¶

To compile python-rtmidi from source and install it manually without pip, you
can either download a source distribution archive or check out the sources from
the Git repository.

While the steps to get the sources differ, the actual compilation step consists
only of the usual python setup.py install command in both cases.

setup.py recognizes several options to control which OS-dependent MIDI
backends will be supported by the python-rtmidi extension binary it produces
plus other options to control compilation of the RtMidi C++ library:

Option

Linux

mac OS / OS X

Windows

Note

--no-alsa

supported

Don’t compile in support for ALSA backend.

--no-jack

supported

supported

Don’t compile in support for JACK backend.

--no-coremidi

supported

Don’t compile in support for CoreMIDI backend.

--no-winmm

supported

Don’t compile in support for Windows MultiMedia backend.

--no-suppress-warnings

Don’t suppress RtMidi warnings to stderr.

Support for each OS dependent MIDI backend is only enabled when the required
library and header files are actually present on the system. When the options
passed to setup.py change, it may be necessary to remove previously built
files by deleting the build directory.

You can also pass these options to setup.py when using pip, by using its
--install-option option, for example:

pip install python-rtmidi --install-option="--no-jack"

From the Source Distribution¶

To download the python-rtmidi source distribution archive for the current
version, extract and install it, use the following commands:

$ pip download python-rtmidi
$ tar -xzf python-rtmidi-1.4.9.tar.gz
$ cd python-rtmidi-1.4.9
$ python setup.py install

On Linux or macOS / OS X, if you want to install python-rtmidi into the
system-wide Python library directory, you may have to prefix the last
command with sudo, e.g.:

$ sudo python setup.py install

The recommended way, though, is to install python-rtmidi only for your current
user (which pip does by default) or into a virtual environment:

$ python setup.py install --user

From the Source Code Repository¶

Alternatively, you can check out the python-rtmidi source code from the Git
repository and then install it from your working copy. Since the repository
does not include the C++ module source code pre-compiled from the Cython
source, you’ll also need to install Cython >= 0.28, either via pip or from its
Git repository. Using virtualenv / virtualenvwrapper is strongly recommended
in this scenario:

Make a virtual environment:

$ mkvirtualenv rtmidi
(rtmidi)$ cdvirtualenv

Install Cython from PyPI:

(rtmidi)$ pip install Cython

or from its Git repository:

(rtmidi)$ git clone https://github.com/cython/cython.git
(rtmidi)$ cd cython
(rtmidi)$ python setup.py install
(rtmidi)$ cd ..

Then install python-rtmidi:

(rtmidi)$ git clone https://github.com/SpotlightKid/python-rtmidi.git
(rtmidi)$ cd python-rtmidi
(rtmidi)$ git submodule update --init
(rtmidi)$ python setup.py install

Requirements¶

Naturally, you’ll need a C++ compiler and a build environment. See the
platform-specific hints below.

If you want to change the Cython source file _rtmidi.pyx or want to
recompile _rtmidi.cpp with a newer Cython version, you’ll need to install
Cython >= 0.28. The _rtmidi.cpp file in the current source distribution
(version 1.4.9) is tagged with:

/* Generated by Cython 0.29.23 */

RtMidi (and therefore python-rtmidi) supports several low-level MIDI frameworks
on different operating systems. Only one of the available options needs to be
present on the target system, but support for more than one can be compiled in.
The setup script will try to detect available libraries and should use the
appropriate compilations flags automatically.

  • Linux: ALSA, JACK

  • macOS (OS X): CoreMIDI, JACK

  • Windows: MultiMedia (MM)

Linux¶

First you need a C++ compiler and the pthread library. Install the
build-essential package on debian-based systems to get these.

Then you’ll need Python development headers and libraries. On debian-based
systems, install the python-dev package. If you use the official installers
from python.org you should already have these.

To get ALSA support, you must install development files for the libasound2
library (debian package: libasound2-dev). For JACK support, install the
libjack development files (if you are using Jack1, install libjack-dev,
if you are using Jack2, install libjack-jackd2-dev).

macOS (OS X)¶

Install the latest Xcode version or g++ from MacPorts or homebrew
(untested). CoreMIDI support comes with installing Xcode. For JACK support,
install JackOSX with the installer or build JACK from source.

Note

If you have an old version of OS X and Xcode which still support building
binaries for PPC, you’ll have to tell distribute to build the package only
for i386 and x86_64 architectures:

env ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install

User Contributed Documentation¶

The python-rtmidi wiki on GitHub contains some user contributed
documentation for additional installation scenarios. Please check these, if
you have trouble installing python-rtmidi in an uncommon or not-yet-covered
environment.

Problem with rtmidi

Got the following error while pulling rtmidi.

The fix for this from what I understand is to install libasound2. However, since I can’t use sudo, what is the alternative for this?

Thanks
Chaoxin

  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc/rtmidi -I/usr/include/python3.5m -c src/_rtmidi.cpp -o build/temp
.linux-x86_64-3.5/src/_rtmidi.o
  cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc/rtmidi -I/usr/include/python3.5m -c src/rtmidi/RtMidi.cpp -o buil
d/temp.linux-x86_64-3.5/src/rtmidi/RtMidi.o
  cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++
  src/rtmidi/RtMidi.cpp:2883:23: fatal error: jack/jack.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1

[edit by admin: formatting]

deleted-user-5153844
|
5
posts
|



Jan. 31, 2019, 12:42 a.m.

|
permalink

From the docs for RtMidi it looks like Jack is an alternative to asound. You might be able to download and compile it from its home page, though you’d need to know how compile C++ code.

Staff

giles
|
11190
posts
|

PythonAnywhere staff
|



Jan. 31, 2019, 1:43 p.m.

|
permalink

I can compile the c++ but how do I get it into the environment to let Python recognized?

deleted-user-5153844
|
5
posts
|



Jan. 31, 2019, 2:20 p.m.

|
permalink

You’ll need to pass in an include path and a library path to the command you are using to install them. Are you using pip?

Staff

giles
|
11190
posts
|

PythonAnywhere staff
|



Jan. 31, 2019, 2:42 p.m.

|
permalink

So you mean compile it and pip it in? Have not done this Before. Any link for a guide? Do I need to put it on a server I guess? Github works?

Thanks
Chaoxin

deleted-user-5153844
|
5
posts
|



Jan. 31, 2019, 2:52 p.m.

|
permalink

Sorry, I think I may have misunderstood. How are you installing rtmidi?

Staff

giles
|
11190
posts
|

PythonAnywhere staff
|



Jan. 31, 2019, 3:44 p.m.

|
permalink

It’s part of the pakacage I am piping from magenta. It always breaks when it tries to install rtmidi.

I looked up the rtmidi forum and they suggested that I need install libasound2 via sudo, but sudo is not supported.

deleted-user-5153844
|
5
posts
|



Jan. 31, 2019, 4:15 p.m.

|
permalink

OK, so if you’re using pip, you can use its --global-option flag; this allows you to pass flags down the setup.py inside the pip package, which in turn means that they can be used by the C compiler.

The C compiler uses its -I option along with a colon-separated path to specify directories for include files, and -L for library files, and setup.py will pass those along.

All this means that if you’ve downloaded and compiled Jack to /home/chaoxin/jack, and it has put its include files in /home/chaoxin/jack/include and the libraries inside /home/chaoxin/jack/lib, you should be able to install the package by doing

pip3.6 install --user yourpackage --global-option="-L/home/chaoxin/jack/lib" --global-option="-I/home/chaoxin/jack/include"

Staff

giles
|
11190
posts
|

PythonAnywhere staff
|



Jan. 31, 2019, 5:07 p.m.

|
permalink

Thanks. Let me give a try and I might come back for more questions.

deleted-user-5153844
|
5
posts
|



Jan. 31, 2019, 6:36 p.m.

|
permalink

OK, great!

Staff

giles
|
11190
posts
|

PythonAnywhere staff
|



Jan. 31, 2019, 6:57 p.m.

|
permalink

teymuri

Using API_UNIX_JACK on Ubuntu prevents note off messages from taking effect. Changing the api to API_LINUX_ALSA solves the issue as expected. Is any one else experiencing this issue? This is my wrapper function around send_message of MidiOut (do not consider the pitch bending part):

MOUT = rtmidi.MidiOut(name="Computil Client", rtapi=rtmidi.API_UNIX_JACK)

def play_note(keynum=60, dur=1, ch=1, vel=127):
    # 3 bytes of NON/NOF messages:
    # [status byte, data byte 1, data byte 2]
    # status byte, first hex digit: 8 for note off, 9 for note on
    # data byte 1: pitch, data byte 2: velocity
    ch -= 1
    non_msg = (NOTE_ON + ch, keynum, vel)
    nof_msg = (NOTE_OFF + ch, keynum, vel)

    # PITCH BENDING #
    fpart, ipart = modf(keynum)
    # https://sites.uci.edu/camp2014/2014/04/30/managing-midi-pitchbend-messages/
    bend_center = 8192
    bend_max = 16384
    semitone_bend_range = (bend_max - bend_center) / 2
    bend_val = bend_center + int(fpart * semitone_bend_range)
    bend_msg = [PITCH_BEND + ch, bend_val & 0x7f, (bend_val >> 7) & 0x7f]
    bend_reset_msg = [PITCH_BEND + ch, bend_center & 0x7f, (bend_center >> 7) & 0x7f]

    try:
        # MOUT.send_message(bend_msg)
        MOUT.send_message(non_msg)
    finally:
        time.sleep(dur)
        MOUT.send_message(nof_msg)
        # MOUT.send_message(bend_reset_msg)
        # MOUT.send_message([CONTROL_CHANGE + ch, 0, 0])

teymuri

Some times by playing around I get this user warning:

UserWarning: MidiOutAlsa::sendMessage: incomplete message!

What is this warning saying?

apinkney97

Hi, installing via pip on Python 3.11.0 on linux, I get

$ pip install python-rtmidi
Collecting python-rtmidi
  Using cached python-rtmidi-1.4.9.tar.gz (251 kB)
  Preparing metadata (setup.py) ... done
Installing collected packages: python-rtmidi
  DEPRECATION: python-rtmidi is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for python-rtmidi ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for python-rtmidi did not run successfully.
  │ exit code: 1
  ╰─> [46 lines of output]
      /tmp/pip-install-7hrewfls/python-rtmidi_71d122c223504a2ebead28914de163d0/setup.py:27: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        JACK1_MIN_VERSION = StrictVersion('0.125.0')
      /tmp/pip-install-7hrewfls/python-rtmidi_71d122c223504a2ebead28914de163d0/setup.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        JACK2_MIN_VERSION = StrictVersion('1.9.11')
      /tmp/pip-install-7hrewfls/python-rtmidi_71d122c223504a2ebead28914de163d0/setup.py:45: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        jv = StrictVersion(res.decode())
      Detected JACK version 1.9.20.
      JACK version is recent enough to have 'jack_port_rename' function.
      running install
      /home/alex/.pyenv/versions/3.11.0/envs/midivis/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/rtmidi
      copying rtmidi/midiutil.py -> build/lib.linux-x86_64-cpython-311/rtmidi
      copying rtmidi/midiconstants.py -> build/lib.linux-x86_64-cpython-311/rtmidi
      copying rtmidi/__init__.py -> build/lib.linux-x86_64-cpython-311/rtmidi
      copying rtmidi/version.py -> build/lib.linux-x86_64-cpython-311/rtmidi
      running egg_info
      writing python_rtmidi.egg-info/PKG-INFO
      writing dependency_links to python_rtmidi.egg-info/dependency_links.txt
      writing top-level names to python_rtmidi.egg-info/top_level.txt
      reading manifest file 'python_rtmidi.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.travis.yml'
      warning: no previously-included files found matching '*.rst.in'
      no previously-included directories found matching 'ci'
      warning: no previously-included files matching '__pycache__' found under directory '*'
      warning: no previously-included files matching '*.py[co]' found under directory '*'
      adding license file 'LICENSE.txt'
      adding license file 'AUTHORS.rst'
      writing manifest file 'python_rtmidi.egg-info/SOURCES.txt'
      running build_ext
      building 'rtmidi._rtmidi' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/src
      creating build/temp.linux-x86_64-cpython-311/src/rtmidi
      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D__RTMIDI_SILENCE_WARNINGS__ -D__LINUX_ALSA__ -D__UNIX_JACK__ -DJACK_HAS_PORT_RENAME -Isrc/rtmidi -I/home/alex/.pyenv/versions/3.11.0/envs/midivis/include -I/home/alex/.pyenv/versions/3.11.0/include/python3.11 -c src/_rtmidi.cpp -o build/temp.linux-x86_64-cpython-311/src/_rtmidi.o
      src/_rtmidi.cpp:243:12: fatal error: longintrepr.h: No such file or directory
        243 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rtmidi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

This seems to be related to python/cpython#28968, where longintrepr.h was moved to cpython/longintrepr.h.

src/_rtmidi.cpp in the .tar.gz that Pip downloads seems to be generated with Cython, so presumably needs to be re-generated with a version of Cython that’s aware of this change.

For the record, I was able to successfully install from source (following the instructions from here) and otherwise everything seems to be working fine.

JPenpichaya

$ pip install python-rtmidi
Collecting python-rtmidi
Using cached python-rtmidi-1.4.9.tar.gz (251 kB)
Preparing metadata (setup.py) … done
Installing collected packages: python-rtmidi
DEPRECATION: python-rtmidi is being installed using the legacy ‘setup.py install’ method, because it does not have a ‘pyproject.toml’ and the ‘wheel’ package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the ‘—use-pep517’ option. Discussion can be found at pypa/pip#8559
Running setup.py install for python-rtmidi … error
error: subprocess-exited-with-error

× Running setup.py install for python-rtmidi did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
/tmp/pip-install-7hrewfls/python-rtmidi_71d122c223504a2ebead28914de163d0/setup.py:27: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
JACK1_MIN_VERSION = StrictVersion(‘0.125.0’)
/tmp/pip-install-7hrewfls/python-rtmidi_71d122c223504a2ebead28914de163d0/setup.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
JACK2_MIN_VERSION = StrictVersion(‘1.9.11’)
/tmp/pip-install-7hrewfls/python-rtmidi_71d122c223504a2ebead28914de163d0/setup.py:45: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
jv = StrictVersion(res.decode())
Detected JACK version 1.9.20.
JACK version is recent enough to have ‘jack_port_rename’ function.
running install
/home/alex/.pyenv/versions/3.11.0/envs/midivis/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/rtmidi
copying rtmidi/midiutil.py -> build/lib.linux-x86_64-cpython-311/rtmidi
copying rtmidi/midiconstants.py -> build/lib.linux-x86_64-cpython-311/rtmidi
copying rtmidi/init.py -> build/lib.linux-x86_64-cpython-311/rtmidi
copying rtmidi/version.py -> build/lib.linux-x86_64-cpython-311/rtmidi
running egg_info
writing python_rtmidi.egg-info/PKG-INFO
writing dependency_links to python_rtmidi.egg-info/dependency_links.txt
writing top-level names to python_rtmidi.egg-info/top_level.txt
reading manifest file ‘python_rtmidi.egg-info/SOURCES.txt’
reading manifest template ‘MANIFEST.in’
warning: no previously-included files found matching ‘.appveyor.yml’
warning: no previously-included files found matching ‘.travis.yml’
warning: no previously-included files found matching ‘.rst.in’
no previously-included directories found matching ‘ci’
warning: no previously-included files matching ‘pycache‘ found under directory ‘

warning: no previously-included files matching ‘.py[co]’ found under directory ‘
adding license file ‘LICENSE.txt’
adding license file ‘AUTHORS.rst’
writing manifest file ‘python_rtmidi.egg-info/SOURCES.txt’
running build_ext
building ‘rtmidi.rtmidi’ extension
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/src
creating build/temp.linux-x86_64-cpython-311/src/rtmidi
gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D__RTMIDI_SILENCE_WARNINGS
_ -D__LINUX_ALSA__ -D__UNIX_JACK__ -DJACK_HAS_PORT_RENAME -Isrc/rtmidi -I/home/alex/.pyenv/versions/3.11.0/envs/midivis/include -I/home/alex/.pyenv/versions/3.11.0/include/python3.11 -c src/_rtmidi.cpp -o build/temp.linux-x86_64-cpython-311/src/_rtmidi.o
src/_rtmidi.cpp:243:12: fatal error: longintrepr.h: No such file or directory
243 | #include «longintrepr.h»
| ^~~~~~~~~~~~~~~
compilation terminated.
error: command ‘/usr/bin/gcc’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rtmidi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failur

teymuri

Is it possible to manage more than 16 channels in rtmidi? I have a synth (Fluidsynth) that supports upto 256 channels, but don’t know how to reach out to them from rtmidi. Any help is highly appreciated!

teymuri

for channel in range(16):

What exactly is the effect of going over channels in the inner for loop here? It would be the same to write the loop content just once, am I right?!

teymuri

Is there already an implemented way for doing microtonality in rtmidi?

Nova-Noir

Hey, I searched for a while and didn’t see the solution using python-rtmidi (maybe it’s because I’m bad at searching)

What I want to do is to read .midi file’s content and to get all of the events, notes or ticks, and then use midioutput to make something like autoplay.

Is there any possible way to do that using python-rtmidi?

JPfeP

Hello,

I would like to know if official support for Python 3.10 is on the way, and if binary wheels are planned as well ? Will it be possible then for you to provide a build for the new M1 arm architecture for Mac OS ?

Greetings,

JP

I would be very glad If someone would help me understand the concept of channels. In the following (from examples directory):

note_on = [NOTE_ON, 60, 112]  # channel 1, middle C, velocity 112
note_off = [NOTE_OFF, 60, 0]

How could I send a note to different channels? I.e. why can’t I use channel numbers in the note_on list to sepcify the channel?

tezza1971

Question: do you anticipate any problems when trying to distribute this module with a blender addon.
If not: are you able to suggest any alternative strategies for installation with a view to building midi controller capability for the Blender environment (ie. should I build a separate stand-alone service to communicate between midi devices and blender addon).

PS. I got the following error when trying to install rtmidi using pip on Windows 10 with python 3.10.4
LINK : fatal error LNK1181: cannot open input file 'python34.lib' error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x64\link.exe' failed with exit status 1181

damp11113

I try to install the python-rtmidi but has error

i use python 3.11

Collecting python-rtmidi
  Using cached python-rtmidi-1.4.9.tar.gz (251 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: python-rtmidi
  Building wheel for python-rtmidi (setup.py): started
  Building wheel for python-rtmidi (setup.py): finished with status 'error'
  Running setup.py clean for python-rtmidi
Failed to build python-rtmidi
Installing collected packages: python-rtmidi
  Running setup.py install for python-rtmidi: started
  Running setup.py install for python-rtmidi: finished with status 'error'

  error: subprocess-exited-with-error
  
  python setup.py bdist_wheel did not run successfully.
  exit code: 1
  
  [41 lines of output]
  C:UserssanswAppDataLocalTemppip-install-l2w4i9anpython-rtmidi_85349052e1e343f09f318a7f2cd7bdf4setup.py:27: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    JACK1_MIN_VERSION = StrictVersion('0.125.0')
  C:UserssanswAppDataLocalTemppip-install-l2w4i9anpython-rtmidi_85349052e1e343f09f318a7f2cd7bdf4setup.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    JACK2_MIN_VERSION = StrictVersion('1.9.11')
  running bdist_wheel
  running build
  running build_py
  creating build
  creating buildlib.win-amd64-cpython-311
  creating buildlib.win-amd64-cpython-311rtmidi
  copying rtmidimidiconstants.py -> buildlib.win-amd64-cpython-311rtmidi
  copying rtmidimidiutil.py -> buildlib.win-amd64-cpython-311rtmidi
  copying rtmidiversion.py -> buildlib.win-amd64-cpython-311rtmidi
  copying rtmidi__init__.py -> buildlib.win-amd64-cpython-311rtmidi
  running egg_info
  writing python_rtmidi.egg-infoPKG-INFO
  writing dependency_links to python_rtmidi.egg-infodependency_links.txt
  writing top-level names to python_rtmidi.egg-infotop_level.txt
  reading manifest file 'python_rtmidi.egg-infoSOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files found matching '.appveyor.yml'
  warning: no previously-included files found matching '.travis.yml'
  warning: no previously-included files found matching '*.rst.in'
  no previously-included directories found matching 'ci'
  warning: no previously-included files matching '__pycache__' found under directory '*'
  warning: no previously-included files matching '*.py[co]' found under directory '*'
  adding license file 'LICENSE.txt'
  adding license file 'AUTHORS.rst'
  writing manifest file 'python_rtmidi.egg-infoSOURCES.txt'
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  building 'rtmidi._rtmidi' extension
  creating buildtemp.win-amd64-cpython-311
  creating buildtemp.win-amd64-cpython-311Release
  creating buildtemp.win-amd64-cpython-311Releasesrc
  creating buildtemp.win-amd64-cpython-311Releasesrcrtmidi
  "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.34.31933binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -D__RTMIDI_SILENCE_WARNINGS__ -D__WINDOWS_MM__ -Isrcrtmidi -IC:UserssanswAppDataLocalProgramsPythonPython311include -IC:UserssanswAppDataLocalProgramsPythonPython311Include "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.34.31933include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt" /EHsc /Tpsrc_rtmidi.cpp /Fobuildtemp.win-amd64-cpython-311Releasesrc_rtmidi.obj /EHsc
  _rtmidi.cpp
  src_rtmidi.cpp(243): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
  error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-rtmidi
  error: subprocess-exited-with-error
  
  Running setup.py install for python-rtmidi did not run successfully.
  exit code: 1
  
  [43 lines of output]
  C:UserssanswAppDataLocalTemppip-install-l2w4i9anpython-rtmidi_85349052e1e343f09f318a7f2cd7bdf4setup.py:27: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    JACK1_MIN_VERSION = StrictVersion('0.125.0')
  C:UserssanswAppDataLocalTemppip-install-l2w4i9anpython-rtmidi_85349052e1e343f09f318a7f2cd7bdf4setup.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    JACK2_MIN_VERSION = StrictVersion('1.9.11')
  running install
  C:UserssanswAppDataLocalProgramsPythonPython311Libsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  running build_py
  creating build
  creating buildlib.win-amd64-cpython-311
  creating buildlib.win-amd64-cpython-311rtmidi
  copying rtmidimidiconstants.py -> buildlib.win-amd64-cpython-311rtmidi
  copying rtmidimidiutil.py -> buildlib.win-amd64-cpython-311rtmidi
  copying rtmidiversion.py -> buildlib.win-amd64-cpython-311rtmidi
  copying rtmidi__init__.py -> buildlib.win-amd64-cpython-311rtmidi
  running egg_info
  writing python_rtmidi.egg-infoPKG-INFO
  writing dependency_links to python_rtmidi.egg-infodependency_links.txt
  writing top-level names to python_rtmidi.egg-infotop_level.txt
  reading manifest file 'python_rtmidi.egg-infoSOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files found matching '.appveyor.yml'
  warning: no previously-included files found matching '.travis.yml'
  warning: no previously-included files found matching '*.rst.in'
  no previously-included directories found matching 'ci'
  warning: no previously-included files matching '__pycache__' found under directory '*'
  warning: no previously-included files matching '*.py[co]' found under directory '*'
  adding license file 'LICENSE.txt'
  adding license file 'AUTHORS.rst'
  writing manifest file 'python_rtmidi.egg-infoSOURCES.txt'
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  building 'rtmidi._rtmidi' extension
  creating buildtemp.win-amd64-cpython-311
  creating buildtemp.win-amd64-cpython-311Release
  creating buildtemp.win-amd64-cpython-311Releasesrc
  creating buildtemp.win-amd64-cpython-311Releasesrcrtmidi
  "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.34.31933binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -D__RTMIDI_SILENCE_WARNINGS__ -D__WINDOWS_MM__ -Isrcrtmidi -IC:UserssanswAppDataLocalProgramsPythonPython311include -IC:UserssanswAppDataLocalProgramsPythonPython311Include "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.34.31933include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt" /EHsc /Tpsrc_rtmidi.cpp /Fobuildtemp.win-amd64-cpython-311Releasesrc_rtmidi.obj /EHsc
  _rtmidi.cpp
  src_rtmidi.cpp(243): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
  error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2
  [end of output]

liudonghua123

I tried to install mido python-rtmidi, however I got the following errors.

shell logs

C:UsersLiu.D.H>pip install mido python-rtmidi
Collecting mido
  Downloading mido-1.2.10-py2.py3-none-any.whl (51 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.1/51.1 kB 434.6 kB/s eta 0:00:00
Collecting python-rtmidi
  Downloading python-rtmidi-1.4.9.tar.gz (251 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 251.2/251.2 kB 1.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: python-rtmidi
  Building wheel for python-rtmidi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [39 lines of output]
      C:UsersLiu.D.HAppDataLocalTemppip-install-x1o51856python-rtmidi_7ca99703f3e44eaeb2251410a1aeeccesetup.py:27: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        JACK1_MIN_VERSION = StrictVersion('0.125.0')
      C:UsersLiu.D.HAppDataLocalTemppip-install-x1o51856python-rtmidi_7ca99703f3e44eaeb2251410a1aeeccesetup.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        JACK2_MIN_VERSION = StrictVersion('1.9.11')
      running bdist_wheel
      running build
      running build_py
      creating build
      creating buildlib.win-amd64-cpython-311
      creating buildlib.win-amd64-cpython-311rtmidi
      copying rtmidimidiconstants.py -> buildlib.win-amd64-cpython-311rtmidi
      copying rtmidimidiutil.py -> buildlib.win-amd64-cpython-311rtmidi
      copying rtmidiversion.py -> buildlib.win-amd64-cpython-311rtmidi
      copying rtmidi__init__.py -> buildlib.win-amd64-cpython-311rtmidi
      running egg_info
      writing python_rtmidi.egg-infoPKG-INFO
      writing dependency_links to python_rtmidi.egg-infodependency_links.txt
      writing top-level names to python_rtmidi.egg-infotop_level.txt
      reading manifest file 'python_rtmidi.egg-infoSOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.travis.yml'
      warning: no previously-included files found matching '*.rst.in'
      no previously-included directories found matching 'ci'
      warning: no previously-included files matching '__pycache__' found under directory '*'
      warning: no previously-included files matching '*.py[co]' found under directory '*'
      adding license file 'LICENSE.txt'
      adding license file 'AUTHORS.rst'
      writing manifest file 'python_rtmidi.egg-infoSOURCES.txt'
      running build_ext
      building 'rtmidi._rtmidi' extension
      creating buildtemp.win-amd64-cpython-311
      creating buildtemp.win-amd64-cpython-311Release
      creating buildtemp.win-amd64-cpython-311Releasesrc
      creating buildtemp.win-amd64-cpython-311Releasesrcrtmidi
      "C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.34.31933binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -D__RTMIDI_SILENCE_WARNINGS__ -D__WINDOWS_MM__ -Isrcrtmidi -IC:UsersLiu.D.HAppDataLocalProgramsPythonPython311include -IC:UsersLiu.D.HAppDataLocalProgramsPythonPython311Include "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.34.31933include" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.34.31933ATLMFCinclude" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /EHsc /Tpsrc_rtmidi.cpp /Fobuildtemp.win-amd64-cpython-311Releasesrc_rtmidi.obj /EHsc
      _rtmidi.cpp
      src_rtmidi.cpp(243): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
      error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-rtmidi
  Running setup.py clean for python-rtmidi
Failed to build python-rtmidi
Installing collected packages: python-rtmidi, mido
  Running setup.py install for python-rtmidi ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-rtmidi did not run successfully.
  │ exit code: 1
  ╰─> [41 lines of output]
      C:UsersLiu.D.HAppDataLocalTemppip-install-x1o51856python-rtmidi_7ca99703f3e44eaeb2251410a1aeeccesetup.py:27: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        JACK1_MIN_VERSION = StrictVersion('0.125.0')
      C:UsersLiu.D.HAppDataLocalTemppip-install-x1o51856python-rtmidi_7ca99703f3e44eaeb2251410a1aeeccesetup.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        JACK2_MIN_VERSION = StrictVersion('1.9.11')
      running install
      C:UsersLiu.D.HAppDataLocalProgramsPythonPython311Libsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating buildlib.win-amd64-cpython-311
      creating buildlib.win-amd64-cpython-311rtmidi
      copying rtmidimidiconstants.py -> buildlib.win-amd64-cpython-311rtmidi
      copying rtmidimidiutil.py -> buildlib.win-amd64-cpython-311rtmidi
      copying rtmidiversion.py -> buildlib.win-amd64-cpython-311rtmidi
      copying rtmidi__init__.py -> buildlib.win-amd64-cpython-311rtmidi
      running egg_info
      writing python_rtmidi.egg-infoPKG-INFO
      writing dependency_links to python_rtmidi.egg-infodependency_links.txt
      writing top-level names to python_rtmidi.egg-infotop_level.txt
      reading manifest file 'python_rtmidi.egg-infoSOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.travis.yml'
      warning: no previously-included files found matching '*.rst.in'
      no previously-included directories found matching 'ci'
      warning: no previously-included files matching '__pycache__' found under directory '*'
      warning: no previously-included files matching '*.py[co]' found under directory '*'
      adding license file 'LICENSE.txt'
      adding license file 'AUTHORS.rst'
      writing manifest file 'python_rtmidi.egg-infoSOURCES.txt'
      running build_ext
      building 'rtmidi._rtmidi' extension
      creating buildtemp.win-amd64-cpython-311
      creating buildtemp.win-amd64-cpython-311Release
      creating buildtemp.win-amd64-cpython-311Releasesrc
      creating buildtemp.win-amd64-cpython-311Releasesrcrtmidi
      "C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.34.31933binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -D__RTMIDI_SILENCE_WARNINGS__ -D__WINDOWS_MM__ -Isrcrtmidi -IC:UsersLiu.D.HAppDataLocalProgramsPythonPython311include -IC:UsersLiu.D.HAppDataLocalProgramsPythonPython311Include "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.34.31933include" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.34.31933ATLMFCinclude" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /EHsc /Tpsrc_rtmidi.cpp /Fobuildtemp.win-amd64-cpython-311Releasesrc_rtmidi.obj /EHsc
      _rtmidi.cpp
      src_rtmidi.cpp(243): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
      error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rtmidi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

C:UsersLiu.D.H>

loveJesus

Aleluya
Thanks for the software! I see that jack can be disabled. But since the readme speaks about compiling with Jack on MacOS, i was successful through this

brew install jack rtmidi
pip3 install python-rtmidi --global-option=build_ext --global-option="-L/opt/homebrew/lib/" --global-option=build_ext --global-option="-I/opt/homebrew/include/"

Otherwise i had trouble finding -ljack . There are may be more brew requirements

p26grinz

cat /etc/os-release
PRETTY_NAME=»Debian GNU/Linux 11 (bullseye)»
NAME=»Debian GNU/Linux»
VERSION_ID=»11″
VERSION=»11 (bullseye)»
VERSION_CODENAME=bullseye
ID=debian
HOME_URL=»https://www.debian.org/»
SUPPORT_URL=»https://www.debian.org/support»
BUG_REPORT_URL=»https://bugs.debian.org/»

uname -a
Linux RPi48 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

dpkg –get-selections >~/pkgs-avail.txt
attached pkgs-avail.txt (note: libasound2 is the alsa interface)
pkgs-avail.txt

python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type «help», «copyright», «credits» or «license» for more information.

quit()

sudo pip3 install python-rtmidi —log /home/pi/piplog.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-rtmidi
Using cached python-rtmidi-1.4.9.tar.gz (251 kB)
Building wheels for collected packages: python-rtmidi
Building wheel for python-rtmidi (setup.py) … error
ERROR: Failed building wheel for python-rtmidi
Running setup.py clean for python-rtmidi
Failed to build python-rtmidi
Installing collected packages: python-rtmidi
Running setup.py install for python-rtmidi … error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-install-l6yay93w/python-rtmidi_71d1b814c487491289fd18cd90e95995/setup.py'»‘»‘; file='»‘»‘/tmp/pip-install-l6yay93w/python-rtmidi_71d1b814c487491289fd18cd90e95995/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record /tmp/pip-record-xuu2riyo/install-record.txt —single-version-externally-managed —compile —install-headers /usr/local/include/python3.9/python-rtmidi Check the logs for full command output.

Attached pip3 output piplog.txt
piplog.txt

The libasound2 library is /usr/lib/aarch64-linux-gnu/libasound.so.2.0.0 with link as libasound.so.2
the header is /usr/include/sound/asound.h

Thanks, Morris

cyberic99

Hi,

I use python-rtmidi with several MIDI input ports at the same time.

So I create multiple rtmidi.MidiIn(), open a port, and set a different callback for each midiIn.

Is it the right way to do it?

because when I some messages simultaneously on several ports, I frequently get:
MidiInAlsa::alsaMidiHandler: unknown MIDI input error!

Using strace, I notices that reading from ALSA ports returns EAGAIN on these cases.

I tried to change the input queue size, and to put locks inside the callback function, but it does not help.

Do you know if rtMidi supports this?

Thanks

mfncooper

The first line of the documentation for each of the open_midiinput, open_midioutput, and open_midiport functions states:

Open MIDI port for input or output and return MidiIn/MidiOut instance.

(or an appropriate variation of the above). This is incorrect, or at least incorrect and misleading.

The Returns clause for open_midiport correctly states that it returns:

A two-element tuple of a new MidiIn or MidiOut instance and the name of the MIDI port which was opened.

This Returns clause is not present for open_midiinput or open_midioutput.

Someone trying to use the simpler open_midiinput or open_midioutput functions is going to be confused as to why this code:

midiout = open_midioutput(0)
midiout.send_message(msg)

gives them the following error:

AttributeError: ‘tuple’ object has no attribute ‘send_message’

The documentation for all three of the open_midi* functions should be updated to state that they return a tuple, not just the MidiIn/MidiOut instance.

mojca

I’m trying to install rtmidi_python on Windows for Python 3.10 without success.
It would probably help if the wheel was available out of the box.

> pip install rtmidi_python
Collecting rtmidi_python
  Using cached rtmidi-python-0.2.2.tar.gz (54 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: rtmidi_python
  Building wheel for rtmidi_python (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'rtmidi_python' extension
      creating build
      creating buildtemp.win-amd64-3.10
      creating buildtemp.win-amd64-3.10Release
      creating buildtemp.win-amd64-3.10ReleaseRtMidi
      C:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D__WINDOWS_MM__ -ID:Pathtovenvinclude -IC:Program FilesPython310include -IC:Program FilesPython310Include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517ATLMFCinclude -IC:Program FilesMicrosoft Visual Studio2022PreviewVCAuxiliaryVSinclude -IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt -IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum /EHsc /TpRtMidi/RtMidi.cpp /Fobuildtemp.win-amd64-3.10ReleaseRtMidi/RtMidi.obj
      RtMidi.cpp
      C:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D__WINDOWS_MM__ -ID:Pathtovenvinclude -IC:Program FilesPython310include -IC:Program FilesPython310Include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517ATLMFCinclude -IC:Program FilesMicrosoft Visual Studio2022PreviewVCAuxiliaryVSinclude -IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt -IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum /EHsc /Tprtmidi_python.cpp /Fobuildtemp.win-amd64-3.10Releasertmidi_python.obj
      rtmidi_python.cpp
      rtmidi_python.cpp(2557): error C2105: '++' needs l-value
      rtmidi_python.cpp(2559): error C2105: '--' needs l-value
      rtmidi_python.cpp(2654): error C2105: '++' needs l-value
      rtmidi_python.cpp(2656): error C2105: '--' needs l-value
      rtmidi_python.cpp(2932): error C2039: 'tp_print': is not a member of '_typeobject'
      C:Program FilesPython310includecpython/object.h(191): note: see declaration of '_typeobject'
      rtmidi_python.cpp(2941): error C2039: 'tp_print': is not a member of '_typeobject'
      C:Program FilesPython310includecpython/object.h(191): note: see declaration of '_typeobject'
      rtmidi_python.cpp(2950): error C2039: 'tp_print': is not a member of '_typeobject'
      C:Program FilesPython310includecpython/object.h(191): note: see declaration of '_typeobject'
      rtmidi_python.cpp(2966): warning C4996: 'PyEval_InitThreads': deprecated in 3.9
      rtmidi_python.cpp(3094): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
      rtmidi_python.cpp(3110): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
      error: command 'C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.33.31517\bin\HostX86\x64\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for rtmidi_python
  Running setup.py clean for rtmidi_python
Failed to build rtmidi_python
Installing collected packages: rtmidi_python
  Running setup.py install for rtmidi_python ... error
  error: subprocess-exited-with-error

  × Running setup.py install for rtmidi_python did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      running install
      running build
      running build_ext
      building 'rtmidi_python' extension
      creating build
      creating buildtemp.win-amd64-3.10
      creating buildtemp.win-amd64-3.10Release
      creating buildtemp.win-amd64-3.10ReleaseRtMidi
      C:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D__WINDOWS_MM__ -ID:Pathtovenvinclude -IC:Program FilesPython310include -IC:Program FilesPython310Include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517ATLMFCinclude -IC:Program FilesMicrosoft Visual Studio2022PreviewVCAuxiliaryVSinclude -IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt -IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum /EHsc /TpRtMidi/RtMidi.cpp /Fobuildtemp.win-amd64-3.10ReleaseRtMidi/RtMidi.obj
      RtMidi.cpp
      C:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D__WINDOWS_MM__ -ID:pathtovenvinclude -IC:Program FilesPython310include -IC:Program FilesPython310Include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517include -IC:Program FilesMicrosoft Visual Studio2022PreviewVCToolsMSVC14.33.31517ATLMFCinclude -IC:Program FilesMicrosoft Visual Studio2022PreviewVCAuxiliaryVSinclude -IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt -IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt -IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum /EHsc /Tprtmidi_python.cpp /Fobuildtemp.win-amd64-3.10Releasertmidi_python.obj
      rtmidi_python.cpp
      rtmidi_python.cpp(2557): error C2105: '++' needs l-value
      rtmidi_python.cpp(2559): error C2105: '--' needs l-value
      rtmidi_python.cpp(2654): error C2105: '++' needs l-value
      rtmidi_python.cpp(2656): error C2105: '--' needs l-value
      rtmidi_python.cpp(2932): error C2039: 'tp_print': is not a member of '_typeobject'
      C:Program FilesPython310includecpython/object.h(191): note: see declaration of '_typeobject'
      rtmidi_python.cpp(2941): error C2039: 'tp_print': is not a member of '_typeobject'
      C:Program FilesPython310includecpython/object.h(191): note: see declaration of '_typeobject'
      rtmidi_python.cpp(2950): error C2039: 'tp_print': is not a member of '_typeobject'
      C:Program FilesPython310includecpython/object.h(191): note: see declaration of '_typeobject'
      rtmidi_python.cpp(2966): warning C4996: 'PyEval_InitThreads': deprecated in 3.9
      rtmidi_python.cpp(3094): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
      rtmidi_python.cpp(3110): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
      error: command 'C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.33.31517\bin\HostX86\x64\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> rtmidi_python

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

dfkettle

Hi!

This is the first time I’ve tried using python-rtmidi. I tried to run the sequence example (sequencer.py), but the last three notes didn’t play. On a hunch, I added a pause in the ‘finally’ block and that took care of the problem. Is this expected behaviour or a bug?

I’m running under Python 3.8 and Windows 10.

try:
    seq.start()
    time.sleep(60. / seq.bpm * 4)
    seq.bpm = 150
    time.sleep(60. / seq.bpm * 6)
finally:
    time.sleep(5)    # added pause
    seq.stop()
    midiout.close_port()
    del midiout

Thanks.

Serhiy1

Hey there,
I’m currently trying to communicate with a device via midi. I’m sending a message to poll for the device’s current configuration and it returns up to 30 bytes of data.

I can use the library to successfully send the device data but I’ve come across some problems trying to receive messages.

I’ve verified that the device is sending back data via the use of MIDI OX.
image

I’ve also verified that get_message() works with conventional midi devices by running the same code with an oxygen8, So this leads me to believe that get_message does not listen to sysEx commands

Here is the code that I have written so far in trying to communicate with the device

midi.zip

Понравилась статья? Поделить с друзьями:
  • Qtranslate ошибка нет данных
  • Qiwi api json validation error
  • Qtcpsocket signal error
  • Qgridlayout pyqt5 как изменить размер
  • Qt5webenginewidgets dll как исправить ошибку