Version 1 (modified by carndt, 7 years ago) (diff)



python-rtmidi uses the de-facto standard Python distutils and setuptools based installation mechanism. Since it is a Python C(++)-extension a C++ compiler and build environment as well as some system-dependant libraries are needed. See "Requirements" below for details.

Installer (Windows only)

An installer with a pre-compiled version for Windows with Windows MultiMedia API support is available through PyPI for some Python versions. Download it from python-rtmidi's PyPI page and start the installer by double-clicking.

From PyPI

If you have all the dependencies, you should be able to install the package with pip or easy_install:

$ pip install python-rtmidi

or, if you prefer easy_install:

$ easy_install python-rtmidi

This will download the source distribution, compile the extension 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.

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

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

From the Source Distribution

Of course, you can also download the source distribution package as a Zip archive or tarball, extract it and install using the common distutils commands, e.g.:

$ wget %(download_url)spython-rtmidi-%(version)s.tar.gz
$ tar -xzf python-rtmidi-%(version)s.tar.gz
$ cd python-rtmidi-%(version)s
$ python install

If you do not have setuptools installed yet, the last command should download it for you into the source directory and use it directly.

From Subversion

Lastly, you can check out the python-rtmidi source code from the Subversion 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.17, 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 the Git repository:

(rtmidi)$ git clone
(rtmidi)$ cd cython
(rtmidi)$ python install
(rtmidi)$ cd ..

Install python-rtmidi:

(rtmidi)$ svn co %(repository)s python-rtmidi
(rtmidi)$ cd python-rtmidi
(rtmidi)$ python install


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

Only 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.17. The _rtmidi.cpp file in the source distribution was generated with Cython 0.18pre as of 2013-01-14 and Python 2.7.3.

RtMidi (and therefore python-rtmidi) supports several low-level MIDI libraries 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
  • OS X: CoreMIDI, JACK
  • Windows: MultiMedia (MM), Windows Kernel Streaming

The osc2midi example, which is installed alongside python-rtmidi additionally requires the pyliblo and PyYAML libraries. These additional dependencies are only installed by the script, if you specify the extra osc2midi, e.g.:

$ pip install "python-rtmidi[osc2midi]"


For the C++ compiler and the pthread library install the build-essential package on debian-based systems.

Then you'll need Python development headers and libraries. On Linux, install the python-dev package. If you use the official installers from you should already have these.

To get ALSA support, you must install development files for the libasound library (debian package: libasound-dev). For JACK support, install the libjack development files (libjack-dev or libjack-jackd2-dev).


Install the latest Xcode or g++ from MacPorts or homebrew (untested). CoreMIDI support comes with installing Xcode. For JACK support, install JACK for OS X with the full installer.


If you have a version of OS X and Xcode which still supports 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 install


On Windows you'll need Visual Studio 2008 (Express) to build python-rtmidi for Python <= 3.2 or Visual Studio 2010 (Express) for Python 3.3 if you use the official Python binary distributions for Windows.

Please see the detailed [[wiki:python-rtmidi/install-windows | instructions for Windows]].