SpotlightKid / python-rtmidi

Python bindings for the cross-platform MIDI I/O library RtMidi
https://spotlightkid.github.io/python-rtmidi/
Other
349 stars 64 forks source link

Build error [due to version field missing] #193

Closed YoshioKobayashi closed 3 months ago

YoshioKobayashi commented 3 months ago

Reqs: Python 3.7 (PIP 24.0, Setuptools 65.5.1)

Problem: Trying to insatll this in pyCharm via Pip normally will result in a build error complaining about a version field.

Collecting python-rtmidi
  Downloading python_rtmidi-1.5.4.tar.gz (327 kB)
     ------------------------------------- 327.6/327.6 kB 10.2 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'

  error: subprocess-exited-with-error

  Preparing metadata (pyproject.toml) did not run successfully.
  exit code: 1

  [52 lines of output]
  + meson setup C:\Users\joda\AppData\Local\Temp\pip-install-uzn1a_8d\python-rtmidi_b3f6fb1504854009a2bc596c3a39705e C:\Users\joda\AppData\Local\Temp\pip-install-uzn1a_8d\python-rtmidi_b3f6fb1504854009a2bc596c3a39705e\.mesonpy-rtdjia28 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dwheel=true -Dverbose=false -Dbuildtype=plain --native-file=C:\Users\joda\AppData\Local\Temp\pip-install-uzn1a_8d\python-rtmidi_b3f6fb1504854009a2bc596c3a39705e\.mesonpy-rtdjia28\meson-python-native-file.ini
  The Meson build system
  Version: 1.4.0
  Source dir: C:\Users\joda\AppData\Local\Temp\pip-install-uzn1a_8d\python-rtmidi_b3f6fb1504854009a2bc596c3a39705e
  Build dir: C:\Users\joda\AppData\Local\Temp\pip-install-uzn1a_8d\python-rtmidi_b3f6fb1504854009a2bc596c3a39705e\.mesonpy-rtdjia28
  Build type: native build
  Project name: python-rtmidi
  Project version: 1.5.4
  Activating VS 16.11.2
  C++ compiler for the host machine: cl (msvc 19.29.30133 "Microsoft (R) C/C++-Optimierungscompiler Version 19.29.30133 f?r x64")
  C++ linker for the host machine: link link 14.29.30133.0
  Host machine cpu family: x86_64
  Host machine cpu: x86_64
  Did not find pkg-config by name 'pkg-config'
  Found pkg-config: NO
  Found CMake: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.20.21032501)
  Run-time dependency jack found: NO (tried pkgconfig and cmake)
  Run-time dependency jack found: NO (tried pkgconfig and cmake)
  ..\meson.build:24: WARNING: No version of JACK found, which is recent enough (jack2>=1.9.11 or jack1>=0.125.0)
  Library winmm found: YES
  Run-time dependency threads found: YES
  WARNING: msvc does not support C++11; attempting best effort; setting the standard to C++14
  Has header "semaphore.h" : NO
  Program python3 found: YES (C:\Users\joda\PycharmProjects\HarmonyMaster\venv37\Scripts\python.exe)
  Program cython found: YES (C:\Users\joda\AppData\Local\Temp\pip-build-env-8y2hju2p\overlay\Scripts\cython.EXE)
  Run-time dependency python found: YES 3.7
  Configuring version.py using configuration
  Build targets in project: 1

  python-rtmidi 1.5.4

    Configuration
      Host machine system     : windows
      Python version          : 3.7
      Debug messages (verbose): false
      Build for wheel         : true
      JACK support            : false
      ALSA support            : false
      CoreMIDI support        : false
      Window MM support       : true

    User defined options
      Native files            : C:\Users\joda\AppData\Local\Temp\pip-install-uzn1a_8d\python-rtmidi_b3f6fb1504854009a2bc596c3a39705e\.mesonpy-rtdjia28\meson-python-native-file.ini
      buildtype               : plain
      b_ndebug                : if-release
      b_vscrt                 : md
      verbose                 : false
      wheel                   : true

  Found ninja.EXE-1.11.1.git.kitware.jobserver-1 at C:\Users\joda\AppData\Local\Temp\pip-build-env-8y2hju2p\overlay\Scripts\ninja.EXE

  ('\x1b[31m',)meson-python: error: Required "project.version" field is missing and not declared as dynamic
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
SpotlightKid commented 3 months ago

Python 3.7 is not supported anymore and the latest version is python-rtmidi 1.5.8, where the project.version field is declared dynamic in pyproject.toml (this was a requirement that was introduced in meson-python >= 0.14.0 only after the release of python-rtmidi 1.5.4).

YoshioKobayashi commented 3 months ago

I see. Cant use Python >3.7 cause I use audiostream which needs an older Cython version. Can I fix this locally somehow?

SpotlightKid commented 3 months ago

https://github.com/SpotlightKid/python-rtmidi/blob/master/INSTALL.md#from-the-source-code-repository

Try the pip and meson method. Either use the latest version from Git or one of the python-rtmidi source distribution archives from PyPI. If using a version of python-rtmidi <= 1.5.5, add dynamic = ['version'] to the project section in pyproject.toml, if necessary.

I can't further support older Python versions or previous python-rtmidi versions, though, so you're on your own!

YoshioKobayashi commented 3 months ago

Alright, wish me luck.