superquadratic / rtmidi-python

Python wrapper for RtMidi
MIT License
56 stars 2 forks source link

PIP failed building wheel for rtmidi-python (subprocess-exited-with-error and legacy-install-failure) #24

Closed hakim-izm closed 2 years ago

hakim-izm commented 2 years ago

Hello everyone, I'm facing an issue with pip while installing rtmidi-python on my Raspberry Pi 4B running Raspbian 11.

The building wheel keeps failing for that package only and I get two errors: subprocess-exited-with-error and legacy-install-failure.

Here's the output for the command pip install rtmidi-python :

pi@raspberrypi:~ $ pip install rtmidi-python
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
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
  ╰─> [164 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'rtmidi_python' extension
      creating build
      creating build/temp.linux-armv7l-3.9
      creating build/temp.linux-armv7l-3.9/RtMidi
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -D__LINUX_ALSA__ -I/usr/include/python3.9 -c RtMidi/RtMidi.cpp -o build/temp.linux-armv7l-3.9/RtMidi/RtMidi.o
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -D__LINUX_ALSA__ -I/usr/include/python3.9 -c rtmidi_python.cpp -o build/temp.linux-armv7l-3.9/rtmidi_python.o
      rtmidi_python.cpp: In function ‘PyObject* PyInit_rtmidi_python()’:
      rtmidi_python.cpp:2932:39: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
       2932 |   __pyx_type_13rtmidi_python_MidiBase.tp_print = 0;
            |                                       ^~~~~~~~
      rtmidi_python.cpp:2941:38: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
       2941 |   __pyx_type_13rtmidi_python_MidiOut.tp_print = 0;
            |                                      ^~~~~~~~
      [...]
      rtmidi_python.cpp:3110:59: note: in expansion of macro ‘PyUnicode_GET_SIZE’
       3110 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                                                           ^~~~~~~~~~~~~~~~~~
      /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/arm-linux-gnueabihf-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: 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
  ╰─> [166 lines of output]
      running install
      /home/pi/.local/lib/python3.9/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_ext
      building 'rtmidi_python' extension
      creating build
      creating build/temp.linux-armv7l-3.9
      creating build/temp.linux-armv7l-3.9/RtMidi
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -D__LINUX_ALSA__ -I/usr/include/python3.9 -c RtMidi/RtMidi.cpp -o build/temp.linux-armv7l-3.9/RtMidi/RtMidi.o
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -D__LINUX_ALSA__ -I/usr/include/python3.9 -c rtmidi_python.cpp -o build/temp.linux-armv7l-3.9/rtmidi_python.o
      rtmidi_python.cpp: In function ‘PyObject* PyInit_rtmidi_python()’:
      rtmidi_python.cpp:2932:39: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
       2932 |   __pyx_type_13rtmidi_python_MidiBase.tp_print = 0;
            |                                       ^~~~~~~~
      rtmidi_python.cpp:2941:38: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
       2941 |   __pyx_type_13rtmidi_python_MidiOut.tp_print = 0;
            |                                      ^~~~~~~~
      [...]
      /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/arm-linux-gnueabihf-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.
╰─> rtmidi-python

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

Pip (22.0.4) and Python (3.9.2) are up to date.

I tried to manually download the package from PyPI (https://pypi.org/project/rtmidi-python/#files) to install it with python setup.py install but it does not seem to install anything : Here's the output:

pi@raspberrypi:~/Downloads/rtmidi-python-0.2.2 $ sudo python setup.py install
running install
running build
running build_ext
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/rtmidi_python-0.2.2.egg-info
Writing /usr/local/lib/python2.7/dist-packages/rtmidi_python-0.2.2.egg-info

For some, that might be a problem with setup.py but I don't know much more. I've been looking for solutions on tons of forums without success. Your help would be appreciated.

Thank you all.

hakim-izm commented 2 years ago

I replaced Python 3.9 with Python 3.7 and it worked fine.