meson icon indicating copy to clipboard operation
meson copied to clipboard

NumPy include directory command not working

Open waarmond opened this issue 1 year ago • 2 comments

Describe the bug ../skimage/meson.build:58:17: ERROR: Command /usr/bin/python -c 'import os; os.chdir(".."); import numpy; print(numpy.get_include())' failed with status 1.

To Reproduce

# NumPy include directory
incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given')
if incdir_numpy == 'not-given'
  # If not specified, try to query NumPy from the build python
  incdir_numpy = run_command(py3,
    [
      '-c',
      'import os; os.chdir(".."); import numpy; print(numpy.get_include())'
    ],
    check: true
  ).stdout().strip()
endif

Expected behavior manually entering import os; os.chdir(".."); import numpy; print(numpy.get_include()) into a Python shell delivers /usr/lib/python3.10/site-packages/numpy/core/include

system parameters

  • ArchLinux-derivative
  • Python 3.10
  • meson "1.4.99" (git build > 1.4.0)
  • ninja 1.11.1

waarmond avatar Apr 11 '24 13:04 waarmond

Are you invoking the build with pip from your local repo? If so, try using "pip install --no-build-isolation ."

efiring avatar Jun 18 '24 02:06 efiring

@waarmond, I faced the same issue. Solved it by adding numpy to the requirements section in my pyproject.toml.

[build-system]
requires = [
  'meson-python', 
  'numpy>=2.0.0'
]
build-backend = 'mesonpy'

shaxov avatar Sep 02 '24 15:09 shaxov

This can be closed I think, seems to be a build config issue rather than a problem in scikit-image or meson.

rgommers avatar Oct 14 '24 07:10 rgommers