YannickJadoul / Parselmouth

Praat in Python, the Pythonic way
https://parselmouth.readthedocs.io/
GNU General Public License v3.0
1.07k stars 116 forks source link

[Build issues] cmake not found / 'ninja' has no attribute 'BIN_DIR' #110

Open meerfrau opened 1 year ago

meerfrau commented 1 year ago

I'm on Python 3.10 and cmake 3.27.8

When building with python -m build --wheel --no-isolation cmake isn't found:

ERROR Missing dependencies:
    cmake>=3.18

python-cmake-build-extension is present but seems not be needed.

When I try my old python setup.py build / python setup.py install recipe it fails:

    setup(
  File "/usr/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 612, in setup
    cmkr = cmaker.CMaker(cmake_executable)
  File "/usr/lib/python3.10/site-packages/skbuild/cmaker.py", line 149, in __init__
    self.platform = get_platform()
  File "/usr/lib/python3.10/site-packages/skbuild/platform_specifics/platform_factory.py", line 24, in get_platform
    return linux.LinuxPlatform()
  File "/usr/lib/python3.10/site-packages/skbuild/platform_specifics/unix.py", line 18, in __init__
    ninja_executable_path = os.path.join(ninja.BIN_DIR, "ninja")
AttributeError: module 'ninja' has no attribute 'BIN_DIR'

Varying python-scikit-build from 0.15 over 0.16.3 to 0.17.6 wasn't enough. Which combination of setuptools and scikit-build works for you?

YannickJadoul commented 12 months ago

Hi @meerfrau. Is there a specific reason you're trying to build with --no-isolation? Normally, if you just run without, all build dependencies get installed.

The first error seems to be referring to this: https://github.com/YannickJadoul/Parselmouth/blob/0bbcca69705ed73322f3712b19d71bb3694b2540/pyproject.toml#L5

In order to ensure CMake, pyproject.toml lists CMake from PyPI (https://pypi.org/project/cmake/). But since you are running with --no-isolation, those extra dependencies aren't installed. If you really insist on using --no-isolation and on using your own CMake rather than install the one from PyPI, maybe you can remove this line from pyproject.toml, but I'm not sure.

I wouldn't directly run setup.py. I thought that's been deprecated for quite some time. When I am building wheels, I use either pip wheel (on CI) or python -m build. On CI, just the latest versions of the packages mentioned seem to work.

Does this information help?