Skip to content

Conversation

@StFroese
Copy link
Collaborator

Problem

Building chromo in a pixi environment failed because:

meson.build was extracting numpy/f2py include paths and adding them to include_directories():

numpy_inc = numpy_dep.get_variable('cflags').split()[0].replace('-I', '')

chromo/meson.build

Lines 29 to 32 in e9310e8

f2py_inc = run_command(
py, '-c',
'import numpy.f2py, pathlib, sys; print((pathlib.Path(numpy.f2py.__file__).parent / "src"))',
check:true).stdout().strip()

chromo/meson.build

Lines 66 to 70 in e9310e8

common_inc = [
src_root,
numpy_inc,
f2py_inc,
]

inc_dirs = common_inc

chromo/meson.build

Lines 265 to 269 in e9310e8

py.extension_module(name,
sources : srcs + [wrap, f2py_obj],
include_directories: include_directories(inc_dirs),
dependencies : [py_dep, numpy_dep],
c_args : common_cargs + flags,

Important

In pixi/conda environments, these paths are absolute (e.g., .pixi/envs/default/lib/python3.14/site-packages/numpy/_core/include).

Warning

Meson doesn't allow absolute paths in include_directories() when they point to locations that appear to be within the source tree.

Solution

Instead of adding numpy/f2py include paths via include_directories(), pass them as compiler arguments (c_args):

numpy_cflag = [numpy_dep.get_variable('cflags').split()[0]]
...
f2py_cflag = ['-I' + f2py_inc]
...
common_cargs = numpy_cflag + f2py_cflag

This allows absolute paths while maintaining compatibility with both traditional pip installs and conda/pixi environments.

This fixes the editable meson build when installed in a conda/pixi
environment where numpy paths are fixed. We switch to forwading numpy
and f2py include dirs as cflags.
@StFroese
Copy link
Collaborator Author

StFroese commented Nov 14, 2025

Since this does not effect the builds on pypi that users install, I suggest to not bump the version to 0.10.1

@StFroese StFroese merged commit bdf3dc5 into main Nov 17, 2025
5 checks passed
@StFroese StFroese deleted the fix_meson branch November 17, 2025 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants