spotify / basic-pitch

A lightweight yet powerful audio-to-MIDI converter with pitch bend detection
https://basicpitch.io
Apache License 2.0
3.47k stars 273 forks source link

Build fails on arch with No module named 'distutils' #149

Open cainmacdotcom opened 1 week ago

cainmacdotcom commented 1 week ago

Describe the bug build fails

To Reproduce Steps to reproduce the behavior:

pip install basic-pitch

Expected behavior build to complete

Screenshots File "/tmp/pip-build-env-mfvu9q2b/overlay/lib/python3.12/site-packages/setuptools/init.py", line 10, in import distutils.core ModuleNotFoundError: No module named 'distutils'

Desktop (please complete the following information):

Additional context c@csam ~]$ paru -Q | grep dist python-distutils-extra 2.39-13

utku-helvaci commented 1 week ago

you don't want to use python 3.12 since it has a required tool depricated: pkgutil.ImpImporter and distutils this is how I did using pipxu and python 3.9 (mind that cuda is for nvidia gpus):

pipxu install basic-pitch --python python3.9
pipxu inject basic-pitch setuptools
pipxu inject basic-pitch basic-pitch[tf]
pipxu inject basic-pitch numpy==1.26.4

assuming that you use python 3.10 or below equivalent commands are:

pip install basic-pitch
pip install setuptools
pip install basic-pitch[tf]
pip install  numpy==1.26.4

Edit: for cuda: (we've to tell numpy version again otherwise it tries to update it): for pipxu:

pipxu inject basic-pitch  tensorflow[and-cuda]==2.14.0 numpy==1.26.4

for pip:

pip install  tensorflow[and-cuda]==2.14.0 numpy==1.26.4

if you're using pipx just replace pipxu with pipx tensorflow==2.14.0 wrapt==1.14.1 keras==2.14.0 ml-dtypes==0.2.0 numpy==1.26.4 protobuf==4.25.5

utku-helvaci commented 1 week ago

we can certainly fix most of these problems by pushing a pull request to requirements file

drubinstein commented 1 week ago

distutils was removed in python3.12. You can either submit a PR that will fix the requirements or install basic pitch in a version of python <3.12