【问题标题】:PIP failed building wheel for rtmidi-python (subprocess-exited-with-error and legacy-install-failure)PIP 为 rtmidi-python 构建轮子失败(子进程退出错误和遗留安装失败)
【发布时间】:2022-07-09 21:37:19
【问题描述】:

为 rtmidi-python 构建轮子的 PIP 失败(子进程退出错误和遗留安装失败)

大家好,我在运行 Raspbian 11 的 Raspberry Pi 4B 上安装 rtmidi-python 时遇到了 pip 问题。

构建轮仅针对该软件包一直失败,我收到两个错误:subprocess-exited-with-error 和 legacy-install-failure。

这是命令 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) 和 Python (3.9.2) 是最新的。

我尝试从 PyPI (https://pypi.org/project/rtmidi-python/#files) 手动下载软件包以使用 python setup.py install 安装它,但它似乎没有安装任何东西: 这是输出:

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

对于某些人来说,这可能是 setup.py 的问题,但我不知道更多。 我一直在寻找大量论坛上的解决方案,但没有成功。我们将不胜感激。

谢谢大家。

【问题讨论】:

    标签: python pip raspbian pypi


    【解决方案1】:

    tp_print 方法已从 Python 3.8 的 API 中删除。错误“'PyTypeObject' {aka 'struct _typeobject'} has no member named 'tp_print'”表示代码适用于 Python

    让我们看看rtmidi-pythonhttps://pypi.org/project/rtmidi-python/#history。目前唯一发布的版本是0.2.2。该版本于 2014 年 2 月 5 日发布。它看起来太旧了,我不确定它是否可以与 Python 3 一起使用。尝试 Python 3.8,然后尝试 Python 2.7。

    【讨论】:

    • 我尝试过使用 Python 3.7,它就像一个魅力!非常感谢您的帮助,我真的很感激。
    【解决方案2】:

    在此页面下方https://spotlightkid.github.io/python-rtmidi/installation.htmlspotlightkid 解释说,您需要 C++ 编译器才能使轮子正常工作。

    我找到的解决方案是在我的 Mac 上安装 xcode 命令行工具,如下所述https://www.freecodecamp.org/news/install-xcode-command-line-tools/

    在那之后,我在 Python 3.10.1 上安装 python-rtmidi 没有问题。

    【讨论】:

      猜你喜欢
      • 2022-08-07
      • 2020-05-12
      • 2016-11-14
      • 2017-09-05
      • 2021-05-23
      • 2013-04-04
      • 2017-05-16
      • 1970-01-01
      • 2019-12-07
      相关资源
      最近更新 更多