Skip to content

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

Closed

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.

Activity

  1. Bubobubobubobubo commented on Oct 27, 2022

    @Bubobubobubobubo

    Same issue here. Chiming in.

  2. krixgris commented on Nov 1, 2022

    @krixgris

    Also running into the same issue.
    I'm getting this error on Mac OS but the same actualy error with longintrepr.h not found.

  3. Bubobubobubobubo commented on Nov 14, 2022

    @Bubobubobubobubo

    It looks like #108 and #115 could be resolved by taking a look at #100. This would be greatly helpful for all python-rtmidi dependant apps developed since last year, especially those depending on mido (which in turn depends on python-rtmidi). Can I be of some help for during this update process?

  4. liudonghua123 commented on Nov 23, 2022

    @liudonghua123

    I tried to build some wheels based on https://github.com/Czaki/python-rtmidi, see https://github.com/liudonghua123/python-rtmidi/releases/tag/1.4.9 .

    Now python-rtmidi works on my python 3.11.

  5. luckydonald commented on Dec 31, 2022

    @luckydonald

    Note, to try the merge request of @Czaki, one can use pip install:

    pip install git+https://github.com/SpotlightKid/python-rtmidi.git@eb16ab3268b29b94cd2baa6bfc777f5cf5f908ba#egg=python-rtmidi
  6. krixgris commented on Dec 31, 2022

    @krixgris

    Note, to try the merge request of @Czaki, one can use pip install:

    pip install git+https://github.com/SpotlightKid/python-rtmidi.git@eb16ab3268b29b94cd2baa6bfc777f5cf5f908ba#egg=python-rtmidi

    Thank you! I am too green to realise you could do that. Tried it this morning and seems to work great.

  7. jenishngl commented on Feb 7, 2023

    @jenishngl

    Note, to try the merge request of @Czaki, one can use pip install:

    pip install git+https://github.com/SpotlightKid/python-rtmidi.git@eb16ab3268b29b94cd2baa6bfc777f5cf5f908ba#egg=python-rtmidi

    This doesnt seem to work for me

  8. georgeharker commented on Feb 12, 2023

    @georgeharker
    Contributor

    This does work for me - would be great to find a way of getting that in the mainline.

  9. Bubobubobubobubo commented on Mar 18, 2023

    @Bubobubobubobubo

    Bump again. We are vendoring our own python-rtmidi-wheels externally as part of the Sardine project and it would be nice to be able to get back to using python-rtmidi without adding to the installation instructions.

  10. rec commented on Mar 23, 2023

    @rec

    @jenishngl:

    I used poetry to successfully install this with the command

    poetry add 'git+https://github.com/SpotlightKid/python-rtmidi.git#eb16ab3268b29b94cd2baa6bfc777f5cf5f908ba'
    @Bubobubobubobubo

    You should be able to reference that specific version in your pyproject.toml or your requirements.txt and not require that additional draggy step for your users!

  11. SpotlightKid commented on Apr 9, 2023

    @SpotlightKid
    Owner

    Hi all, please take note of #137

  12. brunoenten commented on May 21, 2023

    @brunoenten
    Collaborator

    Fixed by merging #119

  13. added a commit that references this issue on Jun 29, 2023
  14. added a commit that references this issue on Feb 16, 2024
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