Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
apinkney97 opened this issue Oct 25, 2022 · 12 comments

Comments

@apinkney97
Copy link

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.

@Bubobubobubobubo
Copy link

Same issue here. Chiming in.

@krixgris
Copy link

krixgris commented Nov 1, 2022

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

@Bubobubobubobubo
Copy link

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?

@liudonghua123
Copy link

liudonghua123 commented Nov 23, 2022

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.

@luckydonald
Copy link

luckydonald commented Dec 31, 2022

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

@krixgris
Copy link

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.

@jenishngl
Copy link

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

@georgeharker
Copy link
Contributor

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

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Feb 21, 2023
@Bubobubobubobubo
Copy link

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.

@rec
Copy link

rec commented Mar 23, 2023

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

@SpotlightKid
Copy link
Owner

Hi all, please take note of #137

@brunoenten
Copy link
Collaborator

Fixed by merging #119

bat553 pushed a commit to bat553/LedFx that referenced this issue Jun 29, 2023
daladim added a commit to daladim/traktor-s4-mk1-midify that referenced this issue Feb 16, 2024
This avoids getting a build issue.
See SpotlightKid/python-rtmidi#115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants