Skip to content

Python 3.11 support (src/_rtmidi.cpp:243:12: fatal error: longintrepr.h: No such file or directory) #115

@apinkney97

Description

@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.

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