SpotlightKid / python-rtmidi

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

[WSL2] Failed to install 1.5.0 via pypi #148

Closed briansemrau closed 1 year ago

briansemrau commented 1 year ago

Installation succeeds with version 1.4.9 but not 1.5.0


Running Ubuntu 20.04 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)

requirements.txt:

ninja==1.10.2.3
meson

mido

# sudo apt-get install libasound-dev
# sudo apt-get install libjack-dev
python-rtmidi

error:

$ pip install --upgrade python-rtmidi
Collecting python-rtmidi
  Using cached python-rtmidi-1.5.0.tar.gz (330 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/brian/rwkv-midi-stream/venv/bin/python3 /home/brian/rwkv-midi-stream/venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-rkig5n7m/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- cython wheel 'mesonpep517 @ git+https://gitlab.com/SpotlightKid/mesonpep517.git@rtmidi' ninja
       cwd: None
  Complete output (100 lines):
  Collecting cython
    Using cached Cython-0.29.34-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (2.0 MB)
  Collecting wheel
    Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
  Collecting mesonpep517@ git+https://gitlab.com/SpotlightKid/mesonpep517.git@rtmidi
    Cloning https://gitlab.com/SpotlightKid/mesonpep517.git (to revision rtmidi) to /tmp/pip-install-c2laihe_/mesonpep517
    Running command git clone -q https://gitlab.com/SpotlightKid/mesonpep517.git /tmp/pip-install-c2laihe_/mesonpep517
    Running command git checkout -b rtmidi --track origin/rtmidi
    Switched to a new branch 'rtmidi'
    branch 'rtmidi' set up to track 'origin/rtmidi'.
    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 wheel metadata: started
      Preparing wheel metadata: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /home/brian/rwkv-midi-stream/venv/bin/python3 /tmp/tmpsw6_wu5f prepare_metadata_for_build_wheel /tmp/tmp71fga20f
           cwd: /tmp/pip-install-c2laihe_/mesonpep517
      Complete output (78 lines):
      Could not run meson: The Meson build system
      Version: 1.1.0
      Source dir: /tmp/pip-install-c2laihe_/mesonpep517
      Build dir: /tmp/tmpzi2xdo00
      Build type: native build
      Project name: mesonpep517
      Project version: 0.2
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Program python3 found: YES (/home/brian/rwkv-midi-stream/venv/bin/python3)
      WARNING: You should add the boolean check kwarg to the run_command call.
               It currently defaults to false,
               but it will default to true in future releases of meson.
               See also: https://github.com/mesonbuild/meson/issues/9300
      Message: Not building documentation
      Build targets in project: 0

      ERROR: Could not detect Ninja v1.8.2 or newer

      A full log can be found at /tmp/tmpzi2xdo00/meson-logs/meson-log.txt

      Full log: Build started at 2023-05-25T01:45:27.328400
      Main binary: /home/brian/rwkv-midi-stream/venv/bin/python3
      Build Options:
      Python system: Linux
      The Meson build system
      Version: 1.1.0
      Source dir: /tmp/pip-install-c2laihe_/mesonpep517
      Build dir: /tmp/tmpzi2xdo00
      Build type: native build
      Project name: mesonpep517
      Project version: 0.2
      Build machine cpu family: x86_64
      Build machine cpu: x86_64
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Target machine cpu family: x86_64
      Target machine cpu: x86_64
      Program python3 found: YES (/home/brian/rwkv-midi-stream/venv/bin/python3)
      WARNING: You should add the boolean check kwarg to the run_command call.
               It currently defaults to false,
               but it will default to true in future releases of meson.
               See also: https://github.com/mesonbuild/meson/issues/9300
      Running command: /home/brian/rwkv-midi-stream/venv/bin/python3 -c 'import hotdoc'
      --- stdout ---

      --- stderr ---
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
      ModuleNotFoundError: No module named 'hotdoc'

      Message: Not building documentation
      Build targets in project: 0

      ERROR: Could not detect Ninja v1.8.2 or newer

      Traceback (most recent call last):
        File "/tmp/tmpsw6_wu5f", line 280, in <module>
          main()
        File "/tmp/tmpsw6_wu5f", line 263, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/tmp/tmpsw6_wu5f", line 133, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-install-c2laihe_/mesonpep517/mesonpep517/buildapi.py", line 658, in prepare_metadata_for_build_wheel
          MesonSetupCommand(builddir, config_settings=config_settings).execute()
        File "/tmp/pip-install-c2laihe_/mesonpep517/mesonpep517/buildapi.py", line 65, in execute
          raise e
        File "/tmp/pip-install-c2laihe_/mesonpep517/mesonpep517/buildapi.py", line 49, in execute
          return subprocess.check_output([self.__exe, *self.args])
        File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/usr/lib/python3.8/subprocess.py", line 516, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['meson', 'setup', '/tmp/tmpzi2xdo00']' returned non-zero exit status 1.
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /home/brian/rwkv-midi-stream/venv/bin/python3 /tmp/tmpsw6_wu5f prepare_metadata_for_build_wheel /tmp/tmp71fga20f Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/brian/rwkv-midi-stream/venv/bin/python3 /home/brian/rwkv-midi-stream/venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-rkig5n7m/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- cython wheel 'mesonpep517 @ git+https://gitlab.com/SpotlightKid/mesonpep517.git@rtmidi' ninja Check the logs for full command output.
SpotlightKid commented 1 year ago

This might be due to insufficiently declared dependencies in the build library used (https://gitlab.com/thiblahute/mesonpep517, or rather my own fork of it).

Can you change your requirements.txt to include meson[ninja] and try again?

SpotlightKid commented 1 year ago

I've updated the rtmidi branch of my fork of mesonpep517, which is used by python-rtmidi, to depend on meson[ninja]. So adding this to your requirements.txt shouldn't be necessary anymore.

Could you test installation from PyPI again?

briansemrau commented 1 year ago

Installation on Windows appears works with no issue. Will later confirm for ubuntu on WSL2.

SpotlightKid commented 1 year ago

Thanks. That sounds promising. Let us know.

theoparis commented 1 year ago

I am having the same issue on NixOS with python3.12 :confused:

SpotlightKid commented 1 year ago

@theoparis Please retry the installation from the source distribution with:

 pip -v install --user --upgrade --no-cache-dir --no-binary python-rtmidi --log python-rtmidi-install.log python-rtmidi

This installs the package under ~/.local/lib and doesn't mess with you system libs.

Please post the contents of python-rtmidi-install.log here (between triple backticks).

You can uninstall it with:

pip uninstall python-rtmidi

To test whether the installation actually works, run

python -c 'import rtmidi; print(rtmidi.__file__); print(rtmidi.MidiOut().get_ports())'

For JACK or pipewire-jack (make sure server is running):

python -c 'import rtmidi; print(rtmidi.MidiOut(rtapi=rtmidi.API_UNIX_JACK).get_ports())'

This should output a Python list of available output port names.

brunoenten commented 1 year ago

python-rtmidi-install.log

I tried with WSL2 like OP and I get a different error. Strangely it cannot find the mesonpep517 module, while having correctly installed it just before.

Successfully installed cython-0.29.35 meson-1.1.1 mesonpep517-0.2 ninja-1.11.1 packaging-23.1 setuptools-67.8.0 toml-0.10.2 wheel-0.40.0 ... ModuleNotFoundError: No module named 'mesonpep517'

Binary wheel install works perfectly 'tho.

SpotlightKid commented 1 year ago

Looks very much like a WSL2-specific problem to me.

brunoenten commented 1 year ago

There's a chance the migration to python-meson will solve this.

brunoenten commented 1 year ago

confirmed that 1.5.3 installs correctly on WSL2 Ubuntu 20.04 LTS from binary wheel.